Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
KevinV91
Regular Visitor

Top N/Filter Greather Than adjusting Percentage Calculation

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% SalesSales
1A18,2%10000
2B16,4%9000
3C14,5%8000
4D12,7%7000
5E10,9%6000
6F9,1%5000
7G7,3%4000
8H5,5%3000
9I3,6%2000
10J1,8%1000

 

Filter TOP5

#Customer% SalesSales
1A25,0%10000
2B22,5%9000
3C20,0%8000
4D17,5%7000
5E15,0%6000

 

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @KevinV91 ,

 

We can create such a measure to meet your requirement.

 

% Sales = 
DIVIDE ( SUM ( Data[Sales] ), SUMX ( ALL ( Data ), Data[Sales] ) )

Check-value-against-entire-column-and-return-value-once-it-1.png

 

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 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lid-msft
Community Support
Community Support

Hi @KevinV91 ,

 

We can create such a measure to meet your requirement.

 

% Sales = 
DIVIDE ( SUM ( Data[Sales] ), SUMX ( ALL ( Data ), Data[Sales] ) )

Check-value-against-entire-column-and-return-value-once-it-1.png

 

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 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.