Forum Discussion
Kent1341
7 years agoHelper I
Including selections as text in Dax code
Hi,
In my product hierarchy, I have several levels. (Category, SubCategory, Segment, SubSegment 1 etc...)
When I calculate shares I use the following code:
VALUE SHARE % =
DIVIDE([VALUE];
CALCULATE([VALUE];
ALL('Product'[MANUFACTURER]);
ALL('Product'[BRAND]);
ALL('Product'[SUBCATEGORY]);
etc...))
This gives me the share within where 100% is total Category also when I eg look at a SubCategory's share of the Category
However - sometimes when I look into a Brand I want to look at a brands share within a SubCategory, and then I need the formula without the line "ALL('Product'[SUBCATEGORY]);"
So - I would like the DAX code to react on selections I make in a slicer. What I select will then be 100% / ALL in the calculation.
I have a table with the texts I need to be in the formula, but where do I go from there?
Br Kent
1 Reply
- v-juanli-msftCommunity Support
Hi Kent1341
It is not clear of your requirment.
Could you give me an example?
I create a example dataset, if it fit your scenario, please add some examples to let me more clear what output you want ?
Best Regards
Maggie