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

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

Reply
dwhittaker1
Helper II
Helper II

Conditional Column in DirectQuery

What is the best way to create a conditional column in direct query with multiple conditions. I would like the condition to state the following.

 

If Original Column = A then T, else if Original Column = B then U, else if Original Column = C then V, else if Original Column = D then W. If none of the criteria is met then return Original Column.

 

See the table below for output

 

Original Column      New Column    
AT
BU
CV
DW
EE
FF
GG
HH
II
1 ACCEPTED SOLUTION
PijushRoy
Super User
Super User

Hi @dwhittaker1 

In Power BI desktop, please create a calculated column and paste the below DAX (update the dax as per your requirement)

 

New Column = SWITCH(
    TRUE(),
    'Table'[Original Column] IN {"A"},"T",
'Table'[Original Column] IN {"B"},"U",
'Table'[Original Column] IN {"C"},"V",
'Table'[Original Column])

 

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

1 REPLY 1
PijushRoy
Super User
Super User

Hi @dwhittaker1 

In Power BI desktop, please create a calculated column and paste the below DAX (update the dax as per your requirement)

 

New Column = SWITCH(
    TRUE(),
    'Table'[Original Column] IN {"A"},"T",
'Table'[Original Column] IN {"B"},"U",
'Table'[Original Column] IN {"C"},"V",
'Table'[Original Column])

 

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.