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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors