Forum Discussion

ghutchins's avatar
ghutchins
Helper II
3 years ago
Solved

Swtich Statement with multiple logic statements

Hello community!  Hoping to get some professional DAX help before I need professional counseling.

Trying to set a value for a list of 15 conditions.  I am starting out with a value of 100 and then evaluate each of the conditions.  If they are met then the value is reduced by a variable amount.  Using a swith statement like immediately below evaluates the first one and stops.

Award Value =
VAR AwardValue = 100
RETURN
SWITCH(
    TRUE,
    [PLAI (This Fiscal Year)]      >   0, AwardValue - 20,
    [GC MTTC >= 10 (Last 30 Days)] >= 10, AwardValue - 7
)
 
Could 'AND' them but it will a a seriously long DAX statement (15^2) because any of the conditions could be true/false and any one time.
Award Value =
VAR AwardValue = 100
RETURN
SWITCH(
    TRUE,

  <condition1> && <condition2> && ... <condition 15>,<result1>,

  <condition1> && <condition2> && ... <condition 15>,<result2>

...

<condition1> && <condition2> && ... <condition 15>,<result15>

)



 

  • ghutchins Perhaps a better way would be to simply have 15 separate IF statements that return the negative value or 0 in variables. Then you just add each variable to your starting Award amount.

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    ghutchins Perhaps a better way would be to simply have 15 separate IF statements that return the negative value or 0 in variables. Then you just add each variable to your starting Award amount.