Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, I have [Sales] by [Category] {A, B, C, D, E}
I want to calculate sales shares such as the below:
How do I set up Slicers & measures to allow a User to select which categories appear in numerator and denominator?
The following code will work for 1 but not for 2
CALCULATE( SUM( [Sales]) , ALLSELECTED( [CATEGORY] )) / CALCULATE( SUM( [Sales]) , ALL( [CATEGORY] ))
Solved! Go to Solution.
I thought I would post my fix as the solution. Others may have a different fix but the below worked for me.
In this scenario, you can't give a dynamic context for both numerator and denominator. For your requirement, I suggest you duplicate your Category column. Then you can use ALLSELECTED for different Category columns.
CALCULATE( SUM( [Sales]) , ALLSELECTED( [CATEGORY1] )) / CALCULATE( SUM( [Sales]) , ALLSELECTED( [CATEGORY2] ))
Regards,
Thanks for the reply, however it doesn't work for me...if [Category2] is just a duplicate of [Category1] then as soon as I apply a slicer or filter to [Category1], [Category2] is automatically filtered to the exact same list of categories.
It seems like I need to duplicate the data set, so I can calculate the numerator and denominator using independent filters...
I thought I would post my fix as the solution. Others may have a different fix but the below worked for me.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |