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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
bhaskarpbi999
Helper V
Helper V

DAX Calculation to count number of working days based on weekend date for current month to date

Hi ,

 

There is a DWH fact table  where revenue and volume for current year and previous years  is stored but for current month data is loaded on weekly basis and we only need DAX logic for current month.

 

For example, We are in Feb'25 and as of now data is  loaded data up to last week 8th Feb'25 Weekend date which is saturday.

 

so i need the DAX calcualtion to count the number of working days for only current month based on weekend date up to 8th Feb excluding saturday and sundays and the expected result should be 5 days.

 

        if  Data loaded up to 8th Feb'25 -   result  should be 5 working days

        if Data loaded up to 15th Feb'25 - result  Should be 10 working days

        if Data loaded up to 22nd Feb,25 - result should be 15 working days.

 

Data sample in DWH table like below.

 

bhaskarpbi999_0-1739295929310.png

 

Could you please help me to write the DAX formula for above scenario.

Thanks in Advance.

 

Regards,

Bhaskar

 

 

 

 

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @bhaskarpbi999 ,

 

You can set variables to get the current year and month, and then set the day to 1 as the beginning of the current month, which is also the start date.

 

Here is my test for your reference.

weekdays = VAR _maxyear = YEAR(MAX('Table'[Weekend Date]))
VAR _maxmonth = MONTH(MAX('Table'[Weekend Date]))
RETURN
NETWORKDAYS(DATE(_maxyear,_maxmonth,1),MAX('Table'[Weekend Date]))

vmengmlimsft_0-1739346898076.png

 

 

 

 

 

——————————————————————————————————————————————————

If my answer helps you solve the problem, please accept my answer as a solution and let it be seen by more people in need.

 

Best regards,

Mengmeng Li

View solution in original post

Hi Mengmeng,

 

Thanks and kudos to your support.

I will try the above solution and will keep you posted many thanks for the support.

 

Thanks 

Bhaskat

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @bhaskarpbi999 ,

 

You can set variables to get the current year and month, and then set the day to 1 as the beginning of the current month, which is also the start date.

 

Here is my test for your reference.

weekdays = VAR _maxyear = YEAR(MAX('Table'[Weekend Date]))
VAR _maxmonth = MONTH(MAX('Table'[Weekend Date]))
RETURN
NETWORKDAYS(DATE(_maxyear,_maxmonth,1),MAX('Table'[Weekend Date]))

vmengmlimsft_0-1739346898076.png

 

 

 

 

 

——————————————————————————————————————————————————

If my answer helps you solve the problem, please accept my answer as a solution and let it be seen by more people in need.

 

Best regards,

Mengmeng Li

Hi Mengmeng,

 

Thanks and kudos to your support.

I will try the above solution and will keep you posted many thanks for the support.

 

Thanks 

Bhaskat

 

parry2k
Super User
Super User

@bhaskarpbi999 have you tried the DAX NetworkDays function?  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.

Hi Parry,

Thanks for your extremed support.

I have only weekend date in my DWH table and for the network days functionwe need start date and end date.

 

bhaskarpbi999_0-1739345500350.png

Could you please help if there is any alternative solution for the above scenario.

Thanks in Advance.

 

Regards,

Bhaska

 

 

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.