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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Janewhite
Frequent Visitor

Case when

Hi all please how would I write this below statement in DAX, been trying to convert this SQL query but I keep getting an error 

 

SQL Script 

 

COALESCE(SUM(CASE WHEN ((CASE WHEN X THEN 1 ELSE 0 END
) = 0) AND (y is not null) THEN datediff(minute, x, x)* 1.0 / 60 ELSE NULL END), 0)

 

Any Recommendation will be much appreciated 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Janewhite , Correct the condition X<>  0

 

 

Sumx(Table, if( if([X] <>0, 1,0)=0 && not(isblank([Y])) , datediff([d1], [d2],minute)/60,blank()))

 

This should be a measure

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Janewhite , Correct the condition X<>  0

 

 

Sumx(Table, if( if([X] <>0, 1,0)=0 && not(isblank([Y])) , datediff([d1], [d2],minute)/60,blank()))

 

This should be a measure

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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