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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Chanise89
Helper I
Helper I

Find Variance based on selected values in Field Parameters

Good Afternoon Everyone,

I have a good one here! 

 

I have a requirement to allow users the ability to create their own Custom Variances exactly as the image below (See image 1)

Chanise89_0-1706645929848.png

 

1. I have created 2 Field Parameters that holds all of the measures used to populate the table and that part works as expected!

Chanise89_2-1706646370009.png

 

The issue I am running into is I need to create a Variance column based on what the user selects from Slicer A minus Slicer B. (refer to Image 1). I've tried different measures but I can't get it to work. 

 

Also I think it's important to note the fields used to create these measures:

Chanise89_3-1706646561096.png

 

Please, If anyone has any insight - it will be greatly appreciated! 

Thank You

4 REPLIES 4
Chanise89
Helper I
Helper I

@Greg_Deckler I see where you are going with this. With this approach, would this require me to add in all the possible selcetions that a user can select? 

@Chanise89 Unfortunately yes. 😞



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

So I am still working through this & I just read your article on your dislike of CALCULATE. 

Is there another way to write this statement w/o the use of CALCULATE:

Q122_Actuals = CALCULATE(
SUM('GL Data'[ACTUAL_AMOUNT]),
  'GL Data'[VCH_QUARTER] = "Q1",
   'GL Data'[N_YEAR] = "2022")
 
I think I have another approach, however I keep running into this error message "DAX comparison operations do not support comparing values of type true/false"
Greg_Deckler
Community Champion
Community Champion

@Chanise89 Well, this is a brute force way to do it. I can't think of anything elegant since most things I have tried around this lead to composite key errors or would require the use of EVALUATE.

Variance = 
    VAR __Var1 = MAX('Variance 1'[Variance 1])
    VAR __Var2 = MAX('Variance 2'[Variance 2])
    VAR __Result = 
        SWITCH(TRUE(),
            __Var1 = "Measure 1" && __Var2 = "Measure 2", [Measure 1] - [Measure 2],
            __Var1 = "Measure 1" && __Var2 = "Measure 3", [Measure 1] - [Measure 3],
            __Var1 = "Measure 2" && __Var2 = "Measure 1", [Measure 2] - [Measure 1],
            __Var1 = "Measure 2" && __Var2 = "Measure 3", [Measure 2] - [Measure 3],
            __Var1 = "Measure 3" && __Var2 = "Measure 1", [Measure 3] - [Measure 1],
            __Var1 = "Measure 3" && __Var2 = "Measure 2", [Measure 3] - [Measure 2]
        )
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.