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

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.

Reply
ppichet
New Member

ALLSELECTED except top 5 in visual level filter?

I'm trying to make a table with sales comparing to total sales in percentage. This table is showing top 5 SKUs by sales by using the visual level filter.


However, when I compare the sales to total sales, I want to compare with all of the SKUs, not just the top 5. Also, this should still works with other slicers. Please find the example below:

 

Raw Data

Client NameSKUSKU NameMonthSales
AA11AAAJan50
AA22BBBJan30
AA33CCCJan10
AA44DDDJan55
AA55EEEJan60
AA66FFFJan80
AA77GGGJan20
AA88HHHJan100
AA11AAAFeb30
AA22BBBFeb60
AA33CCCFeb80
AA44DDDFeb90
AA55EEEFeb120
AA66FFFFeb50
AA77GGGFeb10
AA88HHHFeb5



So the result table would shows something like this (when user did not use any slicer)

SKUSKU NameSalesTotal Sales% Total Sales
A55EEE18085521%
A44DDD14585517%
A66FFF13085515%
A88HHH10585512%
A33CCC9585511%

 

And this should be the result if the user select only the month of Feb

SKUSKU NameSalesTotal Sales% Total Sales
A55EEE12044527%
A44DDD9044520%
A33FFF8044518%
A22HHH6044513%
A66CCC5044511%

 

If I use ALL(), I will always get all the month even when user select only Feb, If I use ALLSELECTED(), I will only got the total sales of the top 5 shown, so the second table the total sales will be 120+90+80+60+50 = 400 instead of 445.

 

Any advice on how can I get Total Sales and % Total Sales to reflect what I want?

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @ppichet,

Based on my test, you could refer to below formula:

Total sales = CALCULATE(SUM(Table1[Sales]),ALLEXCEPT(Table1,Table1[Month]))
%Total sales = SUM(Table1[Sales])/CALCULATE(SUM(Table1[Sales]),ALLEXCEPT(Table1,Table1[Month]))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

2 REPLIES 2
v-danhe-msft
Employee
Employee

Hi @ppichet,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Employee
Employee

Hi @ppichet,

Based on my test, you could refer to below formula:

Total sales = CALCULATE(SUM(Table1[Sales]),ALLEXCEPT(Table1,Table1[Month]))
%Total sales = SUM(Table1[Sales])/CALCULATE(SUM(Table1[Sales]),ALLEXCEPT(Table1,Table1[Month]))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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