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

CASE STATEMENT TO DAX?

Hi Community,

 

I want to convert this CASE STATEMENT SQL Query to DAX?

SQL Query:

1. DayDiff(AddMonths(min(month),3),min(month)) AS tot_days, (Measure 1)

2. CASE WHEN daydiff(Now(),min(month)) > DayDiff(AddMonths(min(month),3),min(month)) THEN DayDiff(AddMonths(min(month),3),min(month)) ELSE daydiff(Now(),min(month)) end AS days_completed (Measure 2)

Is it possible?

 

Reg,

Dhana 

5 REPLIES 5
Anonymous
Not applicable

Everything is possible but without knowing anything about the tabular model, without knowing the tables and relationships involved... not much can be done in this case, I'm afraid.

Best
D
Anonymous
Not applicable

@Anonymous 

give some idea, instead of "Addmonths" what i can use there? I mean alternate DAX function.

Anonymous
Not applicable

CASE in DAX translates into SWITCH.

https://dax.guide/switch/

Best
D
Anonymous
Not applicable

Anonymous
Not applicable

this is the model view (Deals_Active) is my fact table here. Any Idea?

Screenshot_1.png

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