JNH280
JNH280

Reputation: 1

MDX (Tableau) to DAX (Power BI) calculations

I have been using Tableau for quite some time but am getting some new experience with Power BI and the use of DAX, and am wondering how I would go about recreating this formula to DAX.

IF [Threshold] <0 and [Threshold] <[Value] then 'Below'
elseif [Threshold] <0 and [Threshold] >[Value] then 'Above'
ELSEIF  [Threshold] < [Value] THEN 'Above'
ELSEIF [Threshold] > [Value] THEN "Below"
ELSEIF [Threshold] = [Value] THEN "At"
ELSE "N/A"
END

Looking forward to whoever can assist, thank you!

Upvotes: 0

Views: 364

Answers (1)

GregGalloway
GregGalloway

Reputation: 11625

Assuming you already have a measure called Threshold and a measure called Value:


Indicator = SWITCH(
 TRUE(),
 [Threshold] <0 && [Threshold] <[Value], "Below",
 [Threshold] <0 && [Threshold] >[Value], "Above",
 [Threshold] < [Value], "Above",
 [Threshold] > [Value], "Below",
 [Threshold] = [Value], "At",
 "N/A"
)

Upvotes: 0

Related Questions