Forum Discussion
How to show specific value when select different values in slicer?
Hi,
I would like to only show Sub-Category="Lip Stick" and "FDT" when choosing slicer Category="Makeup". So I wrote a measure like following, but didn't get the correct result. May I know where I was wrong and how to adjust it?
Thanks a lot!
How many categories do you have?
maybe you can try DAX formula below. Using two if conditions.
Measure = if(SELECTEDVALUE('Table (2)'[category])="skincare",CALCULATE(MAX('Table'[amount]),FILTER('Table','Table'[sub-category]="Eye care" ||'Table'[sub-category]="Toner")),if(SELECTEDVALUE('Table (2)'[category])="CATEGORY B",CALCULATE(MAX('Table'[amount]),FILTER('Table','Table'[sub-category]="AAA" ||'Table'[sub-category]="BBB")))Hi ryan_mayu Thanks for your explanation.
What I try to say is maybe I have different maxx(xxx), maxx(yyy), maxx(zzz). So maybe I have to write not only one measure right?
For example:
if selectedvalue = "category A", maxx(xxx), ifselectedvalue = "category B", maxx(xxx), if(seletedvalue = "category C",maxx(xx), if(seletectedvalue="category D",maxx(xxx), ifselectedvalue ="category E",maxxc(xxx))))if selectedvalue = "category A", maxx(yyy), ifselectedvalue = "category B", maxx(yyy), if(seletedvalue = "category C",maxx(yyy), if(seletectedvalue="category D",maxx(yyy), ifselectedvalue ="category E",maxxc(yyy))))if selectedvalue = "category A", maxx(zzz), ifselectedvalue = "category B", maxx(zzz), if(seletedvalue = "category C",maxx(zzz), if(seletectedvalue="category D",maxx(zzz), ifselectedvalue ="category E",maxxc(zzz))))
9 Replies
- ryan_mayu
Super User
Maybe you can try something like below.
measure = if( selectedvalue(category[catetory])="Makeup", calculate(sum(amount),filtering(category,category[sub-category]="Lip Stick" || category[sub-category]="FDT"))Since you didn't share the sample file or raw data screenshot, you need to slightly modify the DAX formula.
- ryan_mayu
Super User
Yes, you are correct. Sry about the typo error.
I saw you used MAX in your formula, you can change sum to max as well.
Measure = if(SELECTEDVALUE('Table (2)'[category])="makeup",CALCULATE(MAX('Table'[amount]),FILTER('Table','Table'[sub-category]="lip stick" ||'Table'[sub-category]="FDT")))