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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
3 REPLIES 3
v-stephen-msft
Community Support
Community Support

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors