Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
holywasabi
Frequent Visitor

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" : 

  • Conditions will be based on a supporting table named "Salary sort"
  • Supporting table --> "Salary sort" has 3 columns : Salary Range, Min, Max
  • IF(
        'Employee History'[salary] >= SELECTEDVALUE( 'Salary sort'[Min] )
        &&
        'Employee History'[salary] <=  SELECTEDVALUE( 'Salary sort'[Max] ),
        SELECTEDVALUE( 'Salary sort'[Salary Range] )
    )
     

salary 01@4x.png

 

 

Idk what I'm doing wrong but my calculated column shows nothing 😅

 

File link : https://drive.google.com/file/d/1fX_QSxj3OVJhG3jGk9hLuZXz5sUFESPF/view?usp=sharing

2 ACCEPTED SOLUTIONS
Ankur04
Resolver II
Resolver II

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

View solution in original post

SachinNandanwar
Super User
Super User

Salary Range col =
CALCULATE (
    VALUES ( 'Salary sort'[Salary Range] ),
    FILTER (
        'Salary sort',
        'Employee History'[salary] >= 'Salary sort'[Min]
            && 'Employee History'[salary] <= 'Salary sort'[Max]
    )
)

 

SachinNandanwar_0-1730789310627.png



Regards,
Sachin
Check out my Blog

View solution in original post

3 REPLIES 3
holywasabi
Frequent Visitor

@Ankur04 & @SachinNandanwar  Thanks a lot guys!

I used both of your suggestions and they both work 🙂 

SachinNandanwar
Super User
Super User

Salary Range col =
CALCULATE (
    VALUES ( 'Salary sort'[Salary Range] ),
    FILTER (
        'Salary sort',
        'Employee History'[salary] >= 'Salary sort'[Min]
            && 'Employee History'[salary] <= 'Salary sort'[Max]
    )
)

 

SachinNandanwar_0-1730789310627.png



Regards,
Sachin
Check out my Blog
Ankur04
Resolver II
Resolver II

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.