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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rc8425
Regular Visitor

Cumulative Column Sum between Two Dates

Hello Everyone,

 

This has GOT to be simple and I'm just overthinking it. I am trying to write an expression that returns which work day (non-weekend, non-holiday) a particular date is of a month. I have a Date column, a WorkDayCount column where a 1 represents a non-weekend day/non-holiday, and a 0 denotes a weekend day or holiday. I have a FirstDayofMonth column and a LastDayofMonth column. I want to create a fifth column that indicates the work day of that particular month by performing a cumulative sum of WorkDayCount between the end points of FirstDayofMonth and LastDayofMonth. 

 

Any help is much appreciated! 

1 ACCEPTED SOLUTION

Correct. 

 

After rooting around in the forum, I was able to answer my own question using COUNTROWS filtering on those rows I identified as a non-weekend day/non-holiday with a 1

 

WorkDay =

if(

DateTable[WorkdayCount]=0,

blank(),

calculate(countrows(DateTable),

DATESBETWEEN(DateTable[Date],

STARTOFMONTH(DateTable[Date]),

DateTable[Date]),

DateTable[WorkdayCount]=1,

all(DateTable))

&"WD"

)

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@rc8425 are you looking in date dimension on how many working days are in a month? CorrecT?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Correct. 

 

After rooting around in the forum, I was able to answer my own question using COUNTROWS filtering on those rows I identified as a non-weekend day/non-holiday with a 1

 

WorkDay =

if(

DateTable[WorkdayCount]=0,

blank(),

calculate(countrows(DateTable),

DATESBETWEEN(DateTable[Date],

STARTOFMONTH(DateTable[Date]),

DateTable[Date]),

DateTable[WorkdayCount]=1,

all(DateTable))

&"WD"

)

@rc8425 ok then you can add new column with following DAX, change column and table name as per your data model

 

Month Work Day = 
VAR __firstDate = CALCULATE( MAX( Workday[First] ) )
VAR __lastDaste = CALCULATE( MAX( Workday[Last] ) )
RETURN
CALCULATE( SUM( Workday[Workday] ), Workday[First] >= __firstDate, Workday[Last] <= __lastDaste )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.