Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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.
Could you please help me to write the DAX formula for above scenario.
Thanks in Advance.
Regards,
Bhaskar
Solved! Go to Solution.
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]))
——————————————————————————————————————————————————
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
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]))
——————————————————————————————————————————————————
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
@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.
Could you please help if there is any alternative solution for the above scenario.
Thanks in Advance.
Regards,
Bhaska
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
76 | |
59 | |
35 | |
33 |
User | Count |
---|---|
100 | |
62 | |
56 | |
47 | |
41 |