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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
cmazur71
New Member

How to create a measure that ignores one of my slicers

I have several slicers in my report.   I am trying to create a measure that will ignore one of the slicers

 

CUT = SUM('Data'[Cut Compacted])

 

I use Edit Interactions to get the CUT values to display properly.  One CUT is shown using the Diff1 slicer, and the other CUT is shown using the Diff2 slicer.

The issue I am having is trying to create a measure that can calculate the difference between these 2 CUT values:

I tried this but it's not working:

CUT WITH DIFF1 FILTER = CALCULATE([CUT],FILTER(Data,Data[Diff1] = SELECTEDVALUE(Data[Diff1])))
CUT WITH DIFF2 FILTER = CALCULATE([CUT],FILTER(Data,Data[Diff2] = SELECTEDVALUE(Data[Diff2])))
CUT_CHANGE = [CUT WITH DIFF2 FILTER] - [CUT WITH DIFF1 FILTER]

 

cmazur71_0-1730483730714.png

 

I'm looking for a way to calculate these different CUT values.   

 

Here is a link to my pbix:

https://sendit.hexagon.com/link/ZkiZ5TZrNpNkfgtpbTvaYn

 

 

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

Thanks for the reply from PijushRoy, please allow me to provide another insight.
Hi @cmazur71 ,

Please refer to the following steps.

1. Create a slicer table derived from the diff2 field.

Slcer_diff2 = VALUES(Data[Diff2])

vdengllimsft_0-1730699620384.png


2. Use this slicer table to create a slicer and synchronize it with the existing diff2 slicer.

vdengllimsft_1-1730699766411.png


4. Sets the interaction of the diff1 slicer and the Slicer_diff2 slicer for cards with the CUT_CHANGE measure applied.

vdengllimsft_5-1730700351933.pngvdengllimsft_6-1730700381949.png


5. Use the following DAX to create the CUT_CHANGE measure.

CUT_CHANGE = 
VAR diff1 = SUM(Data[Cut Compacted])
VAR diff2 = 
CALCULATE([CUT], Data[Diff2] IN VALUES(Slcer_diff2[Diff2]),REMOVEFILTERS(Data[Diff1]))
RETURN
diff2-diff1


6. The final result is as follows, hopefully it will meet your needs.

vdengllimsft_7-1730700524679.png

 

Please see the attached pbix for reference.

Best Regards,
Dengliang 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

2 REPLIES 2
v-denglli-msft
Community Support
Community Support

Thanks for the reply from PijushRoy, please allow me to provide another insight.
Hi @cmazur71 ,

Please refer to the following steps.

1. Create a slicer table derived from the diff2 field.

Slcer_diff2 = VALUES(Data[Diff2])

vdengllimsft_0-1730699620384.png


2. Use this slicer table to create a slicer and synchronize it with the existing diff2 slicer.

vdengllimsft_1-1730699766411.png


4. Sets the interaction of the diff1 slicer and the Slicer_diff2 slicer for cards with the CUT_CHANGE measure applied.

vdengllimsft_5-1730700351933.pngvdengllimsft_6-1730700381949.png


5. Use the following DAX to create the CUT_CHANGE measure.

CUT_CHANGE = 
VAR diff1 = SUM(Data[Cut Compacted])
VAR diff2 = 
CALCULATE([CUT], Data[Diff2] IN VALUES(Slcer_diff2[Diff2]),REMOVEFILTERS(Data[Diff1]))
RETURN
diff2-diff1


6. The final result is as follows, hopefully it will meet your needs.

vdengllimsft_7-1730700524679.png

 

Please see the attached pbix for reference.

Best Regards,
Dengliang Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PijushRoy
Super User
Super User

Hi @cmazur71 

To compute the difference between two measures while ignoring specific slicer selections in your Power BI report, you must use CALCULATE combined with ALLSELECTED or REMOVEFILTERS. Below are the steps and DAX code to achieve the desired functionality.
Here is the information, please look into and I hope you can solve the issue.
ALLSELECTED - https://learn.microsoft.com/en-us/dax/allselected-function-dax

REMOVEFILTERS - https://learn.microsoft.com/en-us/dax/removefilters-function-dax

4 DAX Measure code is mentioned below, please update the DAX code as per your requirement

Measure 1
CUT = SUM('Data'[Cut Compacted])

Measure 2
CUT WITH DIFF1 FILTER = CALCULATE(
    [CUT], 
    REMOVEFILTERS('Data'[Diff2]) // Remove filters on Diff2
)

Measure 3
CUT WITH DIFF2 FILTER = CALCULATE(
    [CUT], 
    REMOVEFILTERS('Data'[Diff1]) // remove filters on Diff1
)

Measure 4
CUT_CHANGE = [CUT WITH DIFF2 FILTER] - [CUT WITH DIFF1 FILTER]

 




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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