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
BVdL
Regular Visitor

exclude a value or measure from a slicer

Hello

 

I'm currently working on a tool to calculate different pieces of information for customer sales with one customer slicer. I want to calculate the percentage of a specific customer's total orders compared to the grand total of all customer's orders. However, if I use the slicer to select the specific customer, the grand total is automaticly changed to that sole customer as well, consequently, the formula always renders 100%.

 

Say i have the following:

 

Customer A  20 kg

Customer B   25 kg

Customer C  15 kg

 

when I put the slicer on 'Customer A', the calculation gives me 20/20 --> 100%

I need it to give me 20/60 --> 33,33%

 

Is there any way to work around the slicer selection?

 

Thanks!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Your measure should look like this

 

=SUM(Data[Sold])/CALCULATE(SUM(Data[Sold]),ALL(Data[Customer]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

 

Your measure should look like this

 

=SUM(Data[Sold])/CALCULATE(SUM(Data[Sold]),ALL(Data[Customer]))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur

 

Thanks! this did the trick for the first part! 

I need to exclude 1 particular customer ( in a data set of 50 customers, I need to exclude 1 from the total count.), If I add a second filter with ALLEXCEPT, I still need to create a column that filters out that one customer. I tried adding a FILTER on the ALLEXCEPT as shown below, but it doesn't wat to filter out the customer's name. Any other way to filter this?

 

=SUM(Data[Sold])/CALCULATE(SUM(Data[Sold]),ALL(Data[Customer]),ALLEXCEPT(FILTER(Data[Customer],"Customer A"))

 

Thanks!

Hi,

 

Try this

 

  1. Create a slicer and uncheck Customer A from there
  2. Write this measure

 

=SUM(Data[Sold])/CALCULATE(SUM(Data[Sold]),FILTER(ALL(Data[Customer])))

 

or

 

=SUM(Data[Sold])/CALCULATE(SUM(Data[Sold]),ALLSELECTED(Data[Customer]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
pxg08680
Resolver III
Resolver III

@BVdL

Create a new column as shown below

 

Column = DIVIDE(Customer[Value],SUM(Customer[Value])). Select the new column and go to modelling and select Format: Percentage.

 

a1.PNG

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.