Forum Discussion
DAX Measure with Parameter
Hello,
I am struggling to write the correct DAX measure, most likely due to the measures referencing a paramater.
Here is my current data:
I have Shift (static within table 'Shift Hours') and a user selected parameter for each shift called 'Active' that toggles between 0 (inactive) and 1 (active).
My measure for the Active Field (which references the parameters) is as follows:
I need a measure to return 360, 480 or 0 for the following scenerios:
If shift = 1 and Active = 1 && shift = 2 and Active = 1 && Shift = 3 and Active = 1 then 360
if shift = 1 and Active = 1 && shift = 2 and Active = 1 && Shift = 5 and Active = 1 then 480
else 0
Current scenerio:
I only have Shift 1, 2, and 3 Selected as ACTIVE so I should have a value of 360.
Here is my current measure that does not work.
while it "works" at the row context level in a table, it does not return a singular value of 360
Value =
I have tried so many different variations. I have tried using Sumx and still no luck.
Value:
I am probably over thinking it. Please help.
It would be very easy in excel like so:
I figured it out! I had to call the parameter values as the variables.
I used the following measure:Var sone = SELECTEDVALUE('577_1Active'[577_1Active])Var stwo = SELECTEDVALUE('577_2Active'[577_2Active])Var sthree = SELECTEDVALUE('577_3Active'[577_3Active])Var sfive = SELECTEDVALUE('577_5Active'[577_5Active])returnif(sone=1&&stwo=1&&sthree=1&&sfive=1,360,0)
1 Reply
- ellynneuNew Member
I figured it out! I had to call the parameter values as the variables.
I used the following measure:Var sone = SELECTEDVALUE('577_1Active'[577_1Active])Var stwo = SELECTEDVALUE('577_2Active'[577_2Active])Var sthree = SELECTEDVALUE('577_3Active'[577_3Active])Var sfive = SELECTEDVALUE('577_5Active'[577_5Active])returnif(sone=1&&stwo=1&&sthree=1&&sfive=1,360,0)