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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

date difference open and closed date

It might be the friday syndrome, but i cannot seem to see how to calclulate the date difference between to rows

 

i have the following 

 

Case number | Type              | Date

123456          | Case closed   | 29-08-2017

123456          | Case created | 09-12-2016

 

 

The result should be 263 days to process this case

 

hope someone can help

thanks in advance

 

2 ACCEPTED SOLUTIONS
sanimesa
Post Prodigy
Post Prodigy

A measure like this will work in some circumstances - if you add case numbers and this measure in a table:

 

Days to Process =
VAR date_created = CALCULATE(MAX('Cases'[Date]), 'Cases'[Type]="Case created")
VAR date_closed = CALCULATE(MAX('Cases'[Date]), 'Cases'[Type]="Case closed")
RETURN DATEDIFF(date_created, date_closed,DAY)
//RETURN CALCULATE(COUNTROWS(DimDate), AND(DimDate[Date]>date_created, DimDate[Date]<date_closed), NOT(WEEKDAY(DimDate[Date]) in {1, 7}))

 

But the difference between those two dates is 351, the commented line is to exclude weekends, even that yields 250. 

View solution in original post

2 REPLIES 2
sanimesa
Post Prodigy
Post Prodigy

A measure like this will work in some circumstances - if you add case numbers and this measure in a table:

 

Days to Process =
VAR date_created = CALCULATE(MAX('Cases'[Date]), 'Cases'[Type]="Case created")
VAR date_closed = CALCULATE(MAX('Cases'[Date]), 'Cases'[Type]="Case closed")
RETURN DATEDIFF(date_created, date_closed,DAY)
//RETURN CALCULATE(COUNTROWS(DimDate), AND(DimDate[Date]>date_created, DimDate[Date]<date_closed), NOT(WEEKDAY(DimDate[Date]) in {1, 7}))

 

But the difference between those two dates is 351, the commented line is to exclude weekends, even that yields 250. 

sokg
Solution Supplier
Solution Supplier

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors