cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
KevinV91 Visitor
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

Accepted Solutions
Community Support Team
Community Support Team

Re: Top N/Filter Greather Than adjusting Percentage Calculation

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
Community Support Team
Community Support Team

Re: Top N/Filter Greather Than adjusting Percentage Calculation

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

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 156 members 2,067 guests
Please welcome our newest community members: