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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ctedesco3307
Resolver II
Resolver II

Date Calculations

Hi All - looking for design suggestions on how to calculate this:

 

I have a table of Plans that have a start and end dates. The end goal is to create a report that shows the hours for each plan by Week.


The PlanDate table has
PlanID
PlanStartDate
PlanIDEndDate
HoursPerDay

 

The start date and end dates vary by plan and can span anywhere from a day to a few months

 

The calculation need to be if PlanStartDate_from is < (ThisDay) and PlanIDEndDate >(ThisDay) then HoursPerDay else 0 (or blank)

 

The end goal is to build a report with the plans in the rows and the dates on the columns for each week to show the weekly planned hours by planID

 

So I know I need a Date table using the CALENDAR function to generate the days and then I need to pull in the plan ID and the evaluation on of that plan start date and plan end date fall in that day range.  


I hope this makes sense!  All help welcome 

 

Thanks in advance

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

So you should be able to do this with an expression like the following using a separate date table. 

 

 

Plan Hours = 
SUMX(PlanDate,
    var currentStart = PlanDate[PlanStartDate].[Date]
    var currentEnd = PlanDate[PlanEndDate].[Date]
    return SUMX(FILTER( values( 'Date'[Date]), 'Date'[Date] >= currentStart && 'Date'[Date] <= currentEnd), PlanDate[HoursPerDay])
)

 


Below is a screenshot showing the sample data I entered on the left and the output from the calc on the right. I've also attached the pbix so you can have a play with it yourself

 

d_gosbell_0-1634173483358.png

 

View solution in original post

2 REPLIES 2
ctedesco3307
Resolver II
Resolver II

Thank you so much for your quick reply!! I will try this out this morning!  This is super - helpful. 

d_gosbell
Super User
Super User

So you should be able to do this with an expression like the following using a separate date table. 

 

 

Plan Hours = 
SUMX(PlanDate,
    var currentStart = PlanDate[PlanStartDate].[Date]
    var currentEnd = PlanDate[PlanEndDate].[Date]
    return SUMX(FILTER( values( 'Date'[Date]), 'Date'[Date] >= currentStart && 'Date'[Date] <= currentEnd), PlanDate[HoursPerDay])
)

 


Below is a screenshot showing the sample data I entered on the left and the output from the calc on the right. I've also attached the pbix so you can have a play with it yourself

 

d_gosbell_0-1634173483358.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.