I've used different shampoos before like Head and Shoulders that are specifically meant to target dandruff but have never found them to be effective.
I think in many cases, dandruff should not be an occurrence, but it is often due to our lifestyle decisions such as what we eat and whether or not we stay fit that can determine the health of our skin and potentially whether or not we have dandruff. Of course, there are some people that will have dandruff no matter what, but this post isn't targeted towards them.
What I would recommend is first trying to improve your eating habits and making sure that your GUT HEALTH is at 100%. Eat less sweets and more vegetables. Bone broth is something easy you can make at home and has incredible healing effects on your gut. I would try this for a while and see if it can help. If it doesn't directly improve your dandruff, it would still have been very beneficial to you in other ways.