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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ssmootbokf
Frequent Visitor

Remaining Business Days from TODAY

Goal: To caulcate "Average pace per day needed to hit goal" 

 

I built a Federal Holiday Table and created relationship between it and my "Master Date" Table. 

Next I calculated: Total work days = CALCULATE(COUNT('Master Date'[Master Date].[Date]),FILTER('Master Date','Master Date'[If work day]=1))

Capture.PNG

 

What i need now is "Remaining business days (M-F No Holidays), excluding today left in this month. 

 

I tried:

Work Day Left = COUNTROWS(FILTER(CALENDAR(TODAY(),EOMONTH(TODAY(),0)),WEEKDAY([Date],2)<6))

but it resulted in "18". Today is the 8th, so excluding today and Memorial day there are 16 business days remaining. 

 

I just can't seem to get it right! Help please!  

1 ACCEPTED SOLUTION
edhans
Super User
Super User

This measure works.

Remaining Workdays = 
VAR LastDayOfCurrentMonth =
CALCULATE(
    ENDOFMONTH(Dates[Date]),
    FILTER(Dates,Dates[Month] = MONTH(TODAY()))
)
Return
CALCULATE(
    COUNTROWS(Dates),
    FILTER(Dates,Dates[Date] >= TODAY() && Dates[Date] <= LastDayOfCurrentMonth),
    FILTER(Dates,Dates[WorkDay] = TRUE())
) -1

There might be an shorter way to do this, but I used a true Date table, so I needed it to figure out the last day of the current month regardless of the filter context, so that is what the LastDayOfCurrentMonth variable is figuring out.

 

My date table also has the Workday field as a logical true/false, not 1,0, but you could change my last FILTER() statement to be = 1 vs = TRUE().

The '-1' at the end is because you didn't want to include today. It calculated 15 for me today, which is correct since today is the 9th. 31 - 9 = 22 - 6 weekend days = 16 - 1 Memorial Day holiday = 15.

 

If you want to take a look at my PBIX file it is here. You would just relate the date in my date table to the date in your data table, and it would still work. I used a public holiday calendar, to the number of holidays is unrealistic for most companies, but that can be edited on your side for your particular company.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
edhans
Super User
Super User

This measure works.

Remaining Workdays = 
VAR LastDayOfCurrentMonth =
CALCULATE(
    ENDOFMONTH(Dates[Date]),
    FILTER(Dates,Dates[Month] = MONTH(TODAY()))
)
Return
CALCULATE(
    COUNTROWS(Dates),
    FILTER(Dates,Dates[Date] >= TODAY() && Dates[Date] <= LastDayOfCurrentMonth),
    FILTER(Dates,Dates[WorkDay] = TRUE())
) -1

There might be an shorter way to do this, but I used a true Date table, so I needed it to figure out the last day of the current month regardless of the filter context, so that is what the LastDayOfCurrentMonth variable is figuring out.

 

My date table also has the Workday field as a logical true/false, not 1,0, but you could change my last FILTER() statement to be = 1 vs = TRUE().

The '-1' at the end is because you didn't want to include today. It calculated 15 for me today, which is correct since today is the 9th. 31 - 9 = 22 - 6 weekend days = 16 - 1 Memorial Day holiday = 15.

 

If you want to take a look at my PBIX file it is here. You would just relate the date in my date table to the date in your data table, and it would still work. I used a public holiday calendar, to the number of holidays is unrealistic for most companies, but that can be edited on your side for your particular company.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

I had to make a few tweaks to my table but this totally worked! Thank you so much! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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