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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

CASE STATEMENT for Measures

Can I get the equivalent DAX statement for the following mesures.

 

Measure1: 

COUNT( CASE WHEN
TABLE1.Submit_Date >= TABLE1.StartDate AND
TABLE1.OrderType IN ('Sweaters','Rugs')
THEN TABLE1.Order_Id END)

 

Measure2:

CASE WHEN TABLE2.StartDate >= TABLE1.StartDate AND (Table2.ComDate <= TABLE1.StartDate OR TABLE1.StartDate S NULL) THEN 1 ELSE 0 END

 

Measure3:

COUNT(CASE WHEN TABLE2.StartDate >= TABLE1.StartDate AND (TABLE2.StartDate <= TABLE1.StartDate OR TABLE1.StartDate IS NULL) THEN TABLE2.Id END)

3 REPLIES 3
az38
Community Champion
Community Champion

Hi @Anonymous 

let's try (but it could has an error depends on your data model):

Measure1 = 
COUNTAX('Table1','Table1'[Submit_Date] >= 'Table1'[StartDate] AND
'Table1'[OrderType] IN {"Sweaters","Rugs"})

 

Measure2 = IF('TABLE2'[StartDate] >= 'TABLE1'[StartDate] && ('TABLE2'[ComDate] <= 'TABLE1'[StartDate] || ISBLANK('TABLE1'[StartDate])), 1, 0) 

 

Measure3 = COUNTAX('TABLE2','TABLE2'[StartDate] >= 'TABLE1'[StartDate] && ('TABLE2'[ComDate] <= 'TABLE1'[StartDate] || ISBLANK('TABLE1'[StartDate])) )

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

For Measure1:

I am able to get the following work 

 

Measure 1:=CALCULATE(COUNTA(TABLE1[OrderId]), TABLE1[OrderType] IN {"Sweaters","Rugs"})

 

Measure1:=COUNTAX(FILTER(TABLE1,TABLE1[SubmitDate]>=TABLE1[StartDate]),TABLE1[OrderId])

 

I am unable to combine using the logic u have given.

Anonymous
Not applicable

This Syntax now does not throw errors

Measure 1:=CALCULATE(COUNTA(TABLE1[OrderId]), TABLE1[OrderType] IN {"Sweaters","Rugs"},FILTER(TABLE1,TABLE1[SubmitDate]>=TABLE1[StartDate]))

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.