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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Post Prodigy
Post Prodigy

Calculated Column: IF function

Hi all,


How do I created a calculated column using DAX for the below:


Team = IF 'Username' = 'Adam Thompson' THEN 'London'  




I want a new column called team and each team depends on what the username is.




Community Support
Community Support

According to your description, you can use the SWITCH function. But this work may be troublesome. You need to group each user.
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Not applicable

Or perhaps go back to the source of your data and add an extra column in that table.


But best avoid writing it in Power Query as it doesn't have an equivalent SWITCH statement.

Resolver III
Resolver III


I would recommend that you create a new table and make a relationship to the orginal table.

Then you dont need to write any dax code.





Super User
Super User

You can use if like

IF(table[Username] = "Adam Thompson","London" ,"ABC") 


But in your case it is better to use switch

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Helpful resources

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.