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.
Goodmorning,
I'm quite new to PowerBi but couldnt find the solution to this question on the forum. I need some help with a percentage calculation (% Total Sales), which is affected by a Top N Filter. In the Base calculation the % sales calculation is going well since there are no filters. However when I filter the TOP5 the base where the sales is divded from is adjusted and the % of sales are changing. I would like to keep the % sales the same in the top 5 as in the base. I tried to do it with this DAX function:
% Sales = (DIVIDE([Sales]; CALCULATE([Sales]; ALLSELECTED(Data[CUSTOMER]; Data[Sales]))
Thanks for the help.
Kind regards,
Kevin
BASE
# | Customer | % Sales | Sales |
1 | A | 18,2% | 10000 |
2 | B | 16,4% | 9000 |
3 | C | 14,5% | 8000 |
4 | D | 12,7% | 7000 |
5 | E | 10,9% | 6000 |
6 | F | 9,1% | 5000 |
7 | G | 7,3% | 4000 |
8 | H | 5,5% | 3000 |
9 | I | 3,6% | 2000 |
10 | J | 1,8% | 1000 |
Filter TOP5
# | Customer | % Sales | Sales |
1 | A | 25,0% | 10000 |
2 | B | 22,5% | 9000 |
3 | C | 20,0% | 8000 |
4 | D | 17,5% | 7000 |
5 | E | 15,0% | 6000 |
Solved! Go to Solution.
Hi @KevinV91 ,
We can create such a measure to meet your requirement.
% Sales = DIVIDE ( SUM ( Data[Sales] ), SUMX ( ALL ( Data ), Data[Sales] ) )
BTW, pbix as attached.
Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more
Hi @KevinV91 ,
We can create such a measure to meet your requirement.
% Sales = DIVIDE ( SUM ( Data[Sales] ), SUMX ( ALL ( Data ), Data[Sales] ) )
BTW, pbix as attached.
Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more
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 |
---|---|
111 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |