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
Anonymous
Not applicable

Conditional Column

Hi,

 

I have table and would like to create a column with below logic. I am using directquery so unable to use add column function under the transform data. 

 

If status="not ready" then use reason code from ReasonCode column else use the Status. 

 

Agent      Status   ReasonCode     ***New column needed
1     Ready       Ready
2     Not Ready   Break       Break
3     Not Ready   Meeting        Meeting

 

Thanks,

 

Daven 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Try this

Column = IF( CONTAINSSTRING('Table'[Status], "Not Ready"), 'Table'[ReasonCode], 'Table'[Status])

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Try this

Column = IF( CONTAINSSTRING('Table'[Status], "Not Ready"), 'Table'[ReasonCode], 'Table'[Status])

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

Thanks Phil! 

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.