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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Qotsa
Helper V
Helper V

Calculate based on multiple criteria

Hi,

 

How can this measure be modified to subtract 21 if LOT NUM >5 but not equal to 8

 

Avg Hrs Var = CALCULATE([Average Hrs Worked] - 23,vw_ShiftsAll[LOT Num] <=5 || vw_ShiftsAll[LOT Num] =8)
1 ACCEPTED SOLUTION

@Qotsa 

 

You can use SWITCH function

A pattern like following

 

=
VAR myvalue =
    SELECTEDVALUE ( vw_ShiftsAll[LOT Num] )
RETURN
    SWITCH ( TRUE (), myvalue > 6 && myalue <> 8, [Formula1], [Formula2] )

 


Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@Qotsa 

 

Try

 

Avg Hrs Var =
CALCULATE (
    [Average Hrs Worked] - 21,
    vw_ShiftsAll[LOT Num] > 5
        && vw_ShiftsAll[LOT Num] <> 8
)

Regards
Zubair

Please try my custom visuals

Hi,

 

Thks for the reply.

 

I was looking to combine the 2.

 

Something like:

 

If LOT Num <= 5 & <> 9 then subtract 23 

else if LOT Num > 5 & <> 8 then subtract 21.

@Qotsa 

 

You can use SWITCH function

A pattern like following

 

=
VAR myvalue =
    SELECTEDVALUE ( vw_ShiftsAll[LOT Num] )
RETURN
    SWITCH ( TRUE (), myvalue > 6 && myalue <> 8, [Formula1], [Formula2] )

 


Regards
Zubair

Please try my custom visuals

Yeah, that work perfectly. Thanks a million.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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