Forum Discussion

holywasabi's avatar
holywasabi
Frequent Visitor
1 year ago
Solved

Return value from another column based on conditions

Hi folks   I have a table called "Employee History", it has a column named "Salary".   Appreciate any help offered, much thanks!   I want to create a calculated column called "Salary Sort col" ...
  • Ankur04's avatar
    1 year ago

    Hi holywasabi ,

     

    I would suggest you to create a calculated column as below to achieve the requirement.

     

    Salary Range  = If(Salary >0 && Salary < 39999,"Below $40k",if(Salary >39999 && Salary < 59999,"$40 - $59k", and so on)

     

    let me know if this helps.

     

    Thanks,

     

    Ankur

  • SachinNandanwar's avatar
    1 year ago
    Salary Range col =
    CALCULATE (
        VALUES ( 'Salary sort'[Salary Range] ),
        FILTER (
            'Salary sort',
            'Employee History'[salary] >= 'Salary sort'[Min]
                && 'Employee History'[salary] <= 'Salary sort'[Max]
        )
    )