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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
HALEYSTODDARD
Frequent Visitor

Excel to DAX Date Query

I'm struggling to figure out how to translate this excel formula into Dax... 

 

Essentially I need something to calculate "worked days" vs. "working days" 

 

Excel version:

Working Days =NETWORKDAYS(DATE(2022,12,1),EOMONTH(DATE(2022,12,1),0),'DHL holidays'!$A$2:$A$7) (This is cell B4 in the below formula)

Days Worked = =IF(TODAY()>DATE(2022,12,31),$B$4,($B$4-NETWORKDAYS(TODAY(),EOMONTH(TODAY(),0),'DHL holidays'!$A$2:$A$7)))

 

HALEYSTODDARD_0-1671470549165.png

 

 

DAX info: 

I'm working on a p&l tool that shows YTD financials. 

I need the "days worked" piece to give EOM projections for the current month. 

I'd like the formula to stay current for the month we're currently in vs. me manually putting in the EOM date (2022,12,31) like above in the excel formula. So for example, since this is a year to date tool, once we start in January I want it to count the days worked for january, then as Februry hits the days worked will just be the total days for january and then start over for february (current month) and so on. 

 

I currently have a Dates table that has a 1 if it's a working day 0 if it's a weekend or holiday. 

I just can't figure out how to come up with the formulas.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @HALEYSTODDARD 

Do you mean that you want a formula that automatically calculates the number of working days per month? If the current date is 2022-12-20, then calculate the working days of December? If the date is 2023-01-15, then calculate the working days of January?

 

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @HALEYSTODDARD 

Do you mean that you want a formula that automatically calculates the number of working days per month? If the current date is 2022-12-20, then calculate the working days of December? If the date is 2023-01-15, then calculate the working days of January?

 

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for the response! 

 

I currently have total worked days like this:

Dates[Work Days] is a column that has a 1 if it's a work day, 0 if not.

 

Total_Work_Days = TOTALMTD(sum(Dates[Work Days]),ENDOFMONTH(Dates[DATE]))
 
 
I now need to calculate "Days worked" in the month. 
 
I have something like this:
Working_Days = IF(TODAY()>ENDOFMONTH(Dates[DATE]), TOTALMTD(sum(Dates[Work Days]),ENDOFMONTH(Dates[DATE])),
CALCULATE(TOTALMTD(sum(Dates[Work Days]),ENDOFMONTH(Dates[DATE]))-(DATEDIFF(STARTOFMONTH('Dates'[DATE]),TODAY(),DAY))))
 
the underlined portion is incorrect since it's capturing weekends as well. I essentially just want how many working days in the month have passed. 

@Anonymous 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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