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
Arioli_Chezhian
Helper II
Helper II

Dynamic "IF" condition for calculated column

Hello everyone,
I have a requirement to create a calculated column or Measure to achieve the below mentioned requirement.

Arioli_Chezhian_0-1692679445045.png

If Role 1 has the training T1 it should not be repeated for other Roles. For other roles in the place of T1 it should be 'null' value. 
Likewise for Role 2 it should be T2 and role 3 and so on. If it is only 3 roles in that case we can write using "if" or "switch" function but if it contains 100 or 1000 roles in that case how should we achieve this requirement.

Please advice.

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

Required Output = 
VAR _rx = RANKX('Table',[Name],,ASC,Dense)
VAR _Result = RANKX('Table',[Trainings],,ASC,Dense)
RETURN
IF(_Result=_rx,[Trainings])

Screenshot_2.png

View solution in original post

3 REPLIES 3
Ahmedx
Super User
Super User

pls try this

Required Output = 
VAR _rx = RANKX('Table',[Name],,ASC,Dense)
VAR _Result = RANKX('Table',[Trainings],,ASC,Dense)
RETURN
IF(_Result=_rx,[Trainings])

Screenshot_2.png

@Ahmedx  - Thank you for sharing this result.

If this post helps, then please consider accepting it as the solution to help other members find it faster.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.