Forum Discussion

1001's avatar
1001
Resolver II
3 years ago
Solved

Write a SWITCH statement for a range of Numbers

Hi, I have to write a DAX for a calculated column to group a range of numbers from another column. Just wondering how to do this? 1-8 = "short" 9-15="Medium" 16-30="Long".   Many thanks.
  • FreemanZ's avatar
    FreemanZ
    3 years ago

    hi 1001 

    this shall also work:

    Column2 =
    SWITCH(
        TRUE(),
        [Column1]<=8,  "Short",
        [Column1]<=15, "Medium",
        [Column1]<=30, "Long",
        "Others"
    )