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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How can I convert this SQL CASE to DAX measure

AND (CASE

                 WHEN column1='New Lease' then column2

                 WHEN column1='Move-out' then column3

                 WHEN column1='Renewal' then column4

                                                                                     end ) > 0

 

How can I convert it into a DAX measure?

1 ACCEPTED SOLUTION
NandanHegde
Super User
Super User

Hey,

you can use Switch for this scneraio :

https://community.powerbi.com/t5/Desktop/CASE-Statement-to-DAX/m-p/185548




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

The "CASE WHEN" in SQL is similar to SWITCH() in DAX.

The measure can be created like

SWITCH(MAX('tablename'[column1]), "New Lease", MAX('tablename'[column2]),"Move-out", MAX('tablename'[column3]), "Renewal", MAX('tablename'[column4]))

 

SWITCH function (DAX) - DAX | Microsoft Docs

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

MahyarTF
Memorable Member
Memorable Member

Hi,

You could use nested IF or Switch function in Dax based on your scenario 

Mahyartf
NandanHegde
Super User
Super User

Hey,

you can use Switch for this scneraio :

https://community.powerbi.com/t5/Desktop/CASE-Statement-to-DAX/m-p/185548




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.