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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Calculating number of running business days in a month so far

I illustrated in excel below I need changed in my power bi file. 

Capture.PNG

Currently I calculate workdays with the following calc: Workday = IF(WEEKDAY([Date],2)>5,0,1)

 

To get running total workdays: 

RWkday = CALCULATE(SUM('Date'[Workday]),FILTER(ALL('Date'),'Date'[MYR]=EARLIER('Date'[MYR])&&'Date'[Date].[Day]<=EARLIER('Date'[Date].[Day])))

 

To get total workdays in month: 

MWkday = CALCULATE(MAX('Date'[RWkday]),FILTER(ALL('Date'),'Date'[MYR]=EARLIER('Date'[MYR])))

 

MYR is just Month Year

 

 

So Above, Avg Sales by Business days is: Sales/RWKday (Business Days)

Run Rate is: Avg Sales by Business Days * MWkday (total business days in month)

 

The photo above is an example of looking at a month in process. So in December there have been a total of 8 business days so far. The date connected to when a sale occurs is a transaction date. Not every day does a vendor have a transaction so I have created a calendar table that has a relationship with the transaction date. The reason why there is a 3 for Vendor C and a 6 for Vendor D for business days so far (RWkday) is because those vendors must have only had 3 and 6 days in the month that actually had a transaction date. I would like the running business days RWkday to be agnostic of how many transaction dates a vendor may have in a month. 

 

In yellow is what I would like to change my Power BI file to correctly calculate. So as you can see Vendor C and Vendor D would have 8 business days in total so far regardless of there 3 and 6 transaction dates that have happened. 

 

What have  I done wrong here, or what can I change to get the desired 8 business days for every vendor regardless of # of transaction dates??

 

Thank you so much in advance, I've worked on this so much that I'm unable to look at this in a new way. 

1 REPLY 1
Anonymous
Not applicable

HI @Anonymous,

 

Can you please provide some sample data to test?


Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.