I tested this using inline data and it works as expected when used as a measure. In your scenario, the specific data structure / context may not allow this to be used as a calculated dimension, in which case you will likely have to use aggr() to work around that.
Note that this is not a recommended approach in general. It would be better for performance to create this field in your script (using the formula already provided) and then using that field as your dimension:
Load *, if(Brand_Market='NS Range' OR (Brand_Market = 'Gilenya Market' and not match(Brand_Product,'Gilenya','Mayzent')),Brand_Product) as Brand_Product_For_Chart
Thanks for you reply! The requirement is changed and I need to modify the question a bit . If I select Brand_Market='NS Range', products of NS Range and products of Gilenya Market excluding the two products must be visible. For other markets, as usual all corresponding brand prodcuts must be visible.