The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
I created a measure for % of sales with the following measure:
It works, but in a matrix with a drilldown on the rows, is there a way for the denominator to only include the parent row?
See the below screen shot for an example. [County, State] is the parent rows of [City, State] in the StoreList table ...
In the example of Portland, ME, how can I make sales vol contribution be 40.5% (1,690 / 4,174) instead of 11% (1,690 / 14,867) as shown, without affecting the parent rows which show the county's contribution to the state?
Solved! Go to Solution.
Hi @Mainer04401 , I used some simple data to test and get what you required. Please try below method.
Sample data 'Sales':
Create measures:
Total Sales = SUM(Sales[Total])
Contribution 2 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLSELECTED(Sales)),0)
Contribution 3 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLEXCEPT(Sales,Sales[Country, State])),0)
Final Contribution = IF(ISFILTERED(Sales[City, State]),[Contribution 3],[Contribution 2])
Put Final Contribution in the matrix and see the result:
Reference for ISFILTERED: https://docs.microsoft.com/en-us/dax/ISFILTERED-function-dax
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
Hi @Mainer04401 , I used some simple data to test and get what you required. Please try below method.
Sample data 'Sales':
Create measures:
Total Sales = SUM(Sales[Total])
Contribution 2 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLSELECTED(Sales)),0)
Contribution 3 = DIVIDE([Total Sales],CALCULATE([Total Sales],ALLEXCEPT(Sales,Sales[Country, State])),0)
Final Contribution = IF(ISFILTERED(Sales[City, State]),[Contribution 3],[Contribution 2])
Put Final Contribution in the matrix and see the result:
Reference for ISFILTERED: https://docs.microsoft.com/en-us/dax/ISFILTERED-function-dax
Best Regards,
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.
Just add the City, State column to your ALLSELECTED as below.
Sales Vol Contrib = divide([Total_Vol],calculate([Total_Vol],allselected(StoreList[City, State])),0)
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Mainer04401
try
Sales Vol Contrib = divide([Total_Vol],calculate(sum([Total_Vol]),allexcept('table','table'[parent1],'table'[parent2])),0)
Hope it resolves your issue? Did I answer your question? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!! Linkedin Profile |
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
80 | |
74 | |
52 | |
50 |
User | Count |
---|---|
132 | |
124 | |
78 | |
64 | |
61 |