Forum Discussion

reyesdjr's avatar
reyesdjr
Frequent Visitor
1 year ago
Solved

Switch or If Function

Hello, 

I am using this dax but its not working, its only showing stable demand and not low demand or high demand and I have data from 2020 to 2024.

 

Demand Classification =
IF(
    'ItemsOutbound'[Seasonal Demand Index] > 1.2,
    "High Demand",
    IF(
        'ItemsOutbound'[Seasonal Demand Index] >= 0.9,
        "Stable Demand",
        "Low Demand"
    )
)
 
I also tried this:
 
Demand Classification =
SWITCH(
TRUE(),
'ItemsOutbound'[Seasonal Demand Index] > 1.2, "High Demand",
'ItemsOutbound'[Seasonal Demand Index] >= 0.9 && 'SCM ItemsOutbound'[Seasonal Demand Index] <= 1.2, "Stable Demand",
'ItemsOutbound'[Seasonal Demand Index] < 0.9, "Low Demand"
)
 
but it still showing stable demand. 
 
Please help, thank you!
 

17 Replies

  • pls try this

    Demand Classification =
    IF('ItemsOutbound'[Seasonal Demand Index] <  0.9,  "Low Demand",
        IF('ItemsOutbound'[Seasonal Demand Index] <= 1.2,"Stable Demand","High Demand" )
    )
    • MNedix's avatar
      MNedix
      Solution Sage

      Heya,

      In the Switch function, don't bother with the mid value, go for something like this:

      Demand Classification =
      SWITCH(
      TRUE(),
      'ItemsOutbound'[Seasonal Demand Index] > 1.2, "High Demand",
      'ItemsOutbound'[Seasonal Demand Index] < 0.9, "Low Demand", 
      "Stable Demand"
      )
      • reyesdjr's avatar
        reyesdjr
        Frequent Visitor

        Thank you, I tried but only stable demand is showing.