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! Request now

Reply
Stabben23
Helper I
Helper I

sum workdays with start and end date over weeks

Hi I have a start and end date on every order (Ordertable). I want to sum my workdays (In Calendar table) Related to my start and end date. The model is connected (active) from startdate to Date in calendar and and inactive connection between enddate and Date.

The problem is when I sum workdays who starts in one week and end in another, I have Week as column.

Ex:

I have now filter in a slicer month (June), I get correct sum in weeks when startdate is related to "firstweek", when workdays goes over to next week it does not sum, I want to see the red numbers in my table. Total sum is correct

My Dax is: 

Var mindate = MAX ('Order'[Startdatum] )
var maxdate =MAX ( 'Order'[Slutdatum])
return calculate(SUM (Datum[Workdays]);
FILTER(Datum;
Datum[Datum]>= mindate
&& Datum[Datum] <= maxdate
))

pivot.PNG

2 REPLIES 2
amitchandak
Super User
Super User

@Stabben23 , Try a new measure like

 

Work Day =
COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR(MAX ('Order'[Startdatum] ),MAX ( 'Order'[Slutdatum])),"WorkDay", if(WEEKDAY([Date],2) <6,1,0)),[WorkDay] =1))

 

 

Also check if my video can help

How to calculate Business Days/ Workdays, with or without date table: https://youtu.be/Qv4wT8_P-AA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak If I remove Week from my table it shows correct sum, but I want to see it on Weeklevel.

The problem is when start and end date overlap with 1 or many weeks, if so, it only shows workdays in week where startdate is. 

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.