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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
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.