Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
120 | |
101 | |
71 | |
61 |