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

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
Top Kudoed Authors