cancel
Showing results for
Did you mean:
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 % 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

1 ACCEPTED SOLUTION

Accepted Solutions
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] ) )```

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.
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] ) )```

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.

Announcements

Kudos to you if you earned one of these! Check your inbox for a notification.

#### Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

#### Power Platform World Tour

Find out where you can attend!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (2,027)