Forum Discussion
Isolate measure from graph category
Hi all,
I have found a lot of answers to questions I had on this forum. Now I encounter a challenge to which I cannot find a comparable post yet.
I want to present a distribution of shipment methods. If the total number of shipments is equal of greater than 30, I deem the distribution to be representative. If so, I want to color the bars white. If total shipments <30, I want to color the bars pink.
Challenge I encounter, is that the category drills down the total shipments, and colors the bars based on number of shipments per category.
I tried to workaround this, by setting a measure: if #shipments >30, true = 1, false = 0.
However, also doing it this way, the shipments are also drilled down by the category.
Is there a way to isolate the measurement from this? While still being affected by a date slicer for instance?
Please see the link for a better understanding of my challenge. I want to have all bars pink if total shipment <30, white if >29.
Thank you in advance!
Hi all,
First of all thank you for your your replies and the time you put into my challenge!
I did not came directly to the solution using yourt input on my challenge. In fact I was a bit overwhelmed by the complexity of especially the references to hierachies and INSCOPE functions.
After a lot of searching and reading through a lot more of complex solution, I found a solution very deas imple as I was expected it to be.
First I created the following formula:
#ShipmentsAllMethods = Calculate(Sum('table1'[Shipments]), ALL('table1'[Shipment_method])
Then I created a conditional data color formatting, where if the value is between 0-30 light pink, when value > 30 white.
I did the same for creating graphs with other categories like payment_method or shipment_country.
Hope this simple solution will help others with the same problem.
Again, many thanks guys!
5 Replies
- amitchandakSuper User
Tjeerd , refer this can help
https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/
- v-lili6-msftCommunity Support
hi Tjeerd
For your case, adjst the rule measure as below:
Morethan 30 = IF(CALCULATE([#shipments],FILTER(ALLSELECTED('Table'),'Table'[Level1]=MAX('Table'[Level1])))>30,1,0)Regards,
Lin
- TjeerdHelper I
Hi,
Thank you for your answer. Really think this is into the right direction. I have a question however. What do I fill in for [Level1]? What does that include? Do I have to fill in the column I don't want to filter?
And, what if there are two columns I want to exclude from filtering? Do I have to make a seperate measurement for that?
Thank you in advance!
BR Tjeerd
- v-lili6-msftCommunity Support
hi Tjeerd
If so, you need make a seperate measurement for that, then use ISINSCOPE function to create a IF measure for them
https://xxlbi.com/blog/new-dax-function-isinscope/
if you still have the problem, please share your sample pbix file and your expectedoutput.
Regards,
Lin
- TjeerdHelper I
Hi all,
First of all thank you for your your replies and the time you put into my challenge!
I did not came directly to the solution using yourt input on my challenge. In fact I was a bit overwhelmed by the complexity of especially the references to hierachies and INSCOPE functions.
After a lot of searching and reading through a lot more of complex solution, I found a solution very deas imple as I was expected it to be.
First I created the following formula:
#ShipmentsAllMethods = Calculate(Sum('table1'[Shipments]), ALL('table1'[Shipment_method])
Then I created a conditional data color formatting, where if the value is between 0-30 light pink, when value > 30 white.
I did the same for creating graphs with other categories like payment_method or shipment_country.
Hope this simple solution will help others with the same problem.
Again, many thanks guys!