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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
gus_jr
Helper I
Helper I

Business Days Elapsed for each month.

Hi everyone, i'm looking for a measure that calculate the quantity of business days of each month.

For example, if today was April 17th, the result were 12 days. Otherwise, for the closed months (past months) that calculates entire business days in that month. The table below, may can reflect what I say. THANKS A LOT!!

Today si Apr 17th 
 Business Days Elapsed (Mon to Fri)
Jan23
Feb21
Mar21
Apr17
May0
Jun0
Jul0
Aug0
Sep0
Oct0
Nov0
Dec0
1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @gus_jr ,

 

You can generate your required output in many ways and one example is as follows:

Create a calendar table which identifies weekdays and weekends.  (Please note that this is not identifying national holidays and bank holidays). 

DataNinja777_0-1714663509255.png

You can create a measure of the countrows of the calendar table, keepfiltering weekdays and days on and before today. 

DataNinja777_1-1714663613046.png

I attach the pbix file as an example.  

 

View solution in original post

15 REPLIES 15
parry2k
Super User
Super User

@gus_jr still not sure what the issue is, if you see image below, total kgs sum is 16292 for mayo and there are 7 days, so 16292 / 7 = 2327 and that is what it is showing.

 

Either you provide the number that you are expecting or double check it manually

 

parry2k_0-1715284205623.png

 



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.

parry2k
Super User
Super User

@gus_jr what is your expected output based on sample pbix data? Not clear what the exact problem is?



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.

hi Parry, thanks again. Take a look at the current month. Usually, specifically in this business,  the average daily sales get a pretty uniform behavior month by month. What the example shows us (I think), is that in May, the sales are divided by the total of workdays in that month, instead the six or seven days elapsed until now.
So, look at the "kgs" column, every month is very similar between they. The dayli "kgs" measure, is day by day very regular.

parry2k
Super User
Super User

@gus_jr not sure where the issue is - in your pbix you already calculating days correctly or I am missing something:

 

parry2k_0-1715270456636.png

 



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.

Hi Parry! thank for you answer! yes, you r right, but what i want is that calculate, for example, the sum of sales or tons or whatever, divided the elapsed days. If was a closed month, divide by the total of day of that month closed, and if is in the current month, divide that sum of sales, tons or whathever, by the elapsed days until today or yesterday. I hope my explication have been clear for you!. Thanks again for your efforts.

DataNinja777
Super User
Super User

Hi @gus_jr ,

 

You can generate your required output in many ways and one example is as follows:

Create a calendar table which identifies weekdays and weekends.  (Please note that this is not identifying national holidays and bank holidays). 

DataNinja777_0-1714663509255.png

You can create a measure of the countrows of the calendar table, keepfiltering weekdays and days on and before today. 

DataNinja777_1-1714663613046.png

I attach the pbix file as an example.  

 

Mon to FriJanFebMarAprMay
Tons12001300140015001600
Mon to Fri days until today232121225
AVERAGE DAILY52.261.966.768.2320
      
Mon to SatJanFebMarAprMay
Tons12001300140015001600
Mon to Sat days until today272526266
AVERAGE DAILY44.45253.857.7267
      
Mon to SunJanFebMarAprMay
Tons12001300140015001600
Mon to Sun days until today312931307
AVERAGE DAILY38.744.845.250229

 

 

gus_jr_0-1715135924420.png

 

Thank a lot for your support, it was really usefull, but i have to say, that my doubt wasnt pretty clear. What i need is a measure, called Average Daily, that calculate a divide bewtween, for example, the entire sales volume and the days. If it s a closed month, divide for the total workdays, and if its a curren month, divide for the elapsed days of the acutal month. Here i share a table, maybe help you to understand this better, and a little bit of the dashboard that i been working.

Hi,

Share some data to work with.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, Ashish, thank you for answer. I shared after that first post, a table and screenshoot of that part of the dashboards, on the messages belows.

You are welcome.  That shows the expected result.  It is not the raw data.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

I do not know what result you want.  This is what i get.

Ashish_Mathur_1-1715298503335.png

 

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

thank you, again. Here I share you a PBX file, that try to show the calculate that I looking for. If you realize that in the current month, has been pass 6 days, and I need that the current month has been divide for that 6 days. In the sample that I shared, the sum of tons is divide por the total of workdays of this current month. Thank you, for try help me. 

parry2k
Super User
Super User

@gus_jr you can easily add a column using NETOWRKDAYS dax function, read more here NETWORKDAYS function (DAX) - DAX | Microsoft Learn



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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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