Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all,
I'm struggling getting the decomposition tree to do what I want. I'm currently looking at this example:
You see here that the percentages in plaza are based on the total, which is set to 100%. The categories however, are also based on the first measure, so when you add up all the category percentages, you would get the plaza percentage, instead of 100%
Does anyone know if it is possible to make every step in the tree use 100% as it's base? Maybe using a particular DAX measure?
All thelp is appreciated!
Jaap
Solved! Go to Solution.
Hi @Anonymous ,
I find a solution for you:
Instead of creating calculated columns,you can create a measure:
Measure 2 =
IF (
HASONEFILTER ( 'Table'[category] ),
COUNT ( 'Table'[measure] )
/ CALCULATE ( COUNT ( 'Table'[measure] ), ALLEXCEPT ( 'Table', 'Table'[Plaza] ) ),
COUNT ( 'Table'[measure] )
/ CALCULATE ( COUNT ( 'Table'[measure] ), ALL ( 'Table' ) )
)
Put measure 2 in the "Analyze" filed, and "plaza" and "category" in the "explain by":
Remember to set measure 2 as percentage:
Finally you will see:
For the related .pbix file,pls click here.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hello, to get the percentage, go to analyze section and then open the options, then go at the end to 'show values as', then select 'percent of grand total'
Hope this helps!
In case anyone stumble upon this thread in the future I'll provide my solution.
This guy gave also gave a solution aligned to the previous answers https://bielite.com/blog/calculating-percent-of-subtotal/ous answers, however, not being DAX savvy by any means, reading new formulas like inscope gave heart palpitations.
So what I ended up doing is a couple of pie charts / bar charts to explain these %, the user can now filter in the decomposition tree and see the % on the other visuals. Not the cleanest solution, not the most sophisticated solution, but knowing the audience these categories will change several times and hopefully this approach will remain clear regardless of the order / categories in place.
Cheers,
Great solution . Can you help me with writing a measure using the If condition and the Hasonefilter functions to create the dax measure for 4 EXPLAINED VARIABLES? Thank you
referring the example from your question can you tell me how you are able to show the exact % value . as if I have data as 70% always on decomposition tree it shows as 0.7. I want it to appear as 70% not happening. can anyone give me solution. I have already set the data type as decimal nd formating as percentage.
Hey @Anonymous I think all I did was use the "Show value as" -> "Percent of grand total" when clicking the drop down on your measure. Not sure if that will work for what you are creating...
Hi @Anonymous ,
Based on my research, it cant be realized currently. Logically,"category" is the child node of "plaza",so the total should be the plaza percentage.
Here I have a workaround for you:
Create 2 calculated columns using dax expressions such as below:
combine = 'Table'[Plaza]&"-"&'Table'[category]
Percentage = FORMAT(CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[combine]))/CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Plaza])),"percent")
And you will see:
The value I marked in red line is the one you wanna get.
Here is a sample data you can refer to.
If the workaround cant fulfill what you need, you can come up with a new idea and add your comments there to make this feature coming sooner.
https://ideas.powerbi.com/forums/265200-power-bi-ideas
Thanks a lot for thinking along Kelly,
your solution definitely works for my example, but as always, my example is just a fraction of what the report does. I actually have 5 different "explain by" factors that the users can choose, so that would lead me to need 5! of these combination columns. And users should be able to use the decomposition tree freely, so that they can choose their own order (so category to plaza as well as plaza to category).
I think this is just not possible currently, but I wouldn't be surprised if this is still in development.
Again, thanks a lot for your assistance!
Jaap
Hi @Anonymous ,
I find a solution for you:
Instead of creating calculated columns,you can create a measure:
Measure 2 =
IF (
HASONEFILTER ( 'Table'[category] ),
COUNT ( 'Table'[measure] )
/ CALCULATE ( COUNT ( 'Table'[measure] ), ALLEXCEPT ( 'Table', 'Table'[Plaza] ) ),
COUNT ( 'Table'[measure] )
/ CALCULATE ( COUNT ( 'Table'[measure] ), ALL ( 'Table' ) )
)
Put measure 2 in the "Analyze" filed, and "plaza" and "category" in the "explain by":
Remember to set measure 2 as percentage:
Finally you will see:
For the related .pbix file,pls click here.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
what is [measure]? the one inside that Measure 2 formula is referencing?
Hey Kelly,
Really nice solution! Unfortunately like I said earlier, in the decomposition tree, one of the cool things is that your end users can determine what order to put the categories in. So they can choose to just take category first, and then plaza. In that case your measure, which works really well in this scenario, would not work in other scenario's.
I'll still accept your solution, because it does work for the example I gave you 🙂
Jaap
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
116 | |
101 | |
88 | |
35 | |
35 |
User | Count |
---|---|
152 | |
100 | |
83 | |
63 | |
54 |