Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

IF Formula Help AGAIN

Hi.   I am trying to categorise numerial responses into 3 different categories.   If they answered betweeb 0-1 - I want to categorise that as 0-1 Day Active If they answered between 2-4 - I want...
  • ERD's avatar
    ERD
    5 years ago

    Anonymous ,

    I suppose your Answer column is of Number type.

    If you need a calculated column, then 

     

    Ans_Cat_cln = 
    SWITCH (
        TRUE (),
        ISBLANK(T[Answer]), BLANK (),
        T[Answer] <= 1, "0-1 Active",
        T[Answer] <= 4, "2-4 Active",
        "5+ Active"
    )

     

    If you need a measure, then

     

    #Ans_Cat = 
    VAR currentAnswer = MAX ( T[Answer] )
    RETURN
        IF (
            HASONEVALUE ( T[Answer] ),
            COALESCE (
                SWITCH (
                    TRUE (),
                    ISBLANK(currentAnswer), BLANK (),
                    currentAnswer <= 1, "0-1 Active",
                    currentAnswer <= 4, "2-4 Active",
                    "5+ Active"
                ),
                ""
            )
        )

     

    If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.