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
surena01
Regular Visitor

Calculating duration over time

Hello,

 

I'm having trouble with figuring out a formula calculating durations over time. 

 

In my fact table, I have my Records with Start Date and End Date. 

 

I have created a relationship between the Start and End Dates with my Calendar Table for Dates. 

 

The fact table has blank fields for both Start and End Dates. 

 

For calculating durations I would run into 3 scenarios:

 

1. Start Date is Blank: where Duration should result in Blank.

2. Start Date not Blank and End Date is Blank:  where the Duration should be based on the difference between Start Date and the Calendar Date greater than the Start Date until the End Date is not Blank. Once the End Date is not Blank the Duration should result in Blank on any date greater than the End Date. 

3. Start Date not Blank and End Date not Blank:  where the Duration is based on the difference between Start Date and Calendar Date until the End Date is not Blank. Any date greater that the End Date should result in Blank.

 

Maybe I'm overcomplicating the issue but the purpose of this calculation would be to Count the total records with Durations

 

above 14 days on any given day. 

 

Thank you in advance. 

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @surena01

Actually, I don't understand the following statement.

"where the Duration should be based on the difference between Start Date and the Calendar Date greater than the Start Date until the End Date is not Blank. Once the End Date is not Blank the Duration should result in Blank on any date greater than the End Date"

Could you give me an example of what you want?

 

Best Regards

Maggie

Hi Maggie,

 

Visually in Excel I was trying to do something where for each date there would be a dynamic duration for every application.

 

Excel Duration.PNG

 

 

 

surena01
Regular Visitor

Hello,

 

I'm having trouble with figuring out a formula calculating durations over time. 

 

In my fact table, I have my Records with Start Date and End Date. 

 

I have created a relationship between the Start and End Dates with my Calendar Table for Dates. 

 

The fact table has blank fields for both Start and End Dates. 

 

For calculating durations I would run into 3 scenarios:

 

1. Start Date is Blank: where Duration should result in Blank.

2. Start Date not Blank and End Date is Blank:  where the Duration should be based on the difference between Start Date and the Calendar Date greater than the Start Date until the End Date is not Blank. Once the End Date is not Blank the Duration should result in Blank on any date greater than the End Date. 

3. Start Date not Blank and End Date not Blank:  where the Duration is based on the difference between Start Date and Calendar Date until the End Date is not Blank. Any date greater that the End Date should result in Blank.

 

Maybe I'm overcomplicating the issue but the purpose of this calculation would be to Count the total records with Durations

 

above 14 days on any given day. 

 

Thank you in advance. 

surena01
Regular Visitor

This is the formula I have but it doesn't calculate dynamically.

 

DATEDIFF(
MAX(
MIN(fScheduleOverviewToday[Construction Actual Start Date]),
MIN(CalendarDate[Date])
),
MIN(
MAX(fScheduleOverviewToday[Construction Actual End Date]),
MAX(CalendarDate[Date])
),
DAY)

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