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
ellynneu
New Member

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). 

ellynneu_1-1699468216503.png

 



My measure for the Active Field (which references the parameters) is as follows:

Active_Param =
Var Shifty = max('Shift-Hours'[Shift])
RETURN
if(or(and(Shifty="1",[577_1Active Value]=1),or(
and(Shifty="2",[577_2Active Value]=1),or(
and(Shifty="3",[577_3Active Value]=1),
and(Shifty="5",[577_5Active Value]=1))))),1,0)

 

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 =

VAR Shifty = max('Shift-Hours'[Shift])
RETURN
if([Active_Param]=1,
if(
    Shifty="1"||Shifty="2"||Shifty="3",360,0),0)

ellynneu_2-1699468243904.png


I have tried so many different variations. I have tried using Sumx and still no luck.
Value:

Var Shifty = max('Shift-Hours'[Shift])
Var Activey = [Active_Param]
Var rowVal = if(Activey=1,if( Shifty="1"||Shifty="2"||Shifty="3",360,0),0)
return

SUMX(
    'Shift-Hours',
   rowVal)



I am probably over thinking it. Please help. 



It would be very easy in excel like so:

ellynneu_3-1699468594713.png

 



1 ACCEPTED SOLUTION
ellynneu
New 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])
return
if(sone=1&&stwo=1&&sthree=1&&sfive=1,360,0)



View solution in original post

1 REPLY 1
ellynneu
New 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])
return
if(sone=1&&stwo=1&&sthree=1&&sfive=1,360,0)



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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.