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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
ctedesco3307
Resolver II
Resolver II

Date diff Working Days to Today with filter

I have a table that has all the working days identifed for a project between the start and end date. I need a measure to add up all the working days for each project from Start date to today, Thanks in advance 

 

ctedesco3307_0-1661782241505.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ctedesco3307 ,

 

I suggest you to try this code to create a measure.

Measure = 
VAR _MINDATE = MIN(MAX('Table'[End Date]),TODAY())
VAR _COUNT = CALCULATE(SUM('Table'[Working Day]),FILTER('Table','Table'[MSSContractDay]<=_MINDATE))+0
RETURN
_COUNT

 

Best Regards,
Rico Zhou

 

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

6 REPLIES 6
amitchandak
Super User
Super User

@ctedesco3307 ,

A new column

networkdays([Start Date], Today(),1)

 

https://amitchandak.medium.com/power-bi-dax-function-networkdays-5c8e4aca38c

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  thank you but the function needs to sum the workingday column in the table if workingday = 1  -- not just omit saturday and sunday - we have company holidays also 

Anonymous
Not applicable

Hi @ctedesco3307 ,

 

I suggest you to try this code to create a measure.

Measure = 
VAR _MINDATE = MIN(MAX('Table'[End Date]),TODAY())
VAR _COUNT = CALCULATE(SUM('Table'[Working Day]),FILTER('Table','Table'[MSSContractDay]<=_MINDATE))+0
RETURN
_COUNT

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

hi Rico,

am using your DAX statement like this:

DaysDiff =
 VAR _MINDATE= MIN(MAX('KPI Delivery'[InvoiceDate]), TODAY())
 VAR _COUNT = CALCULATE(SUM('KPI Delivery'[InvoiceWeekendDay]),FILTER('KPI Delivery', 'KPI Delivery'[InvoiceDate]<=_MINDATE))+0
 
 RETURN
 _COUNT
The measure seems to be working but as soon as i add the measure to a visual i get this error message: 
MdxScript(Model (5,29) Calculation error in measure TABLE [DaysDiff]; the function SUM cannot work with values of type string.  Can you help. thnx!!


Anonymous
Not applicable

hi Rico,

forget about my question, found the issue and solved it.

The measure is working!

thnx!!!!

@ctedesco3307 , Please refer blog I shared complete information on how to use the holiday calendar

https://amitchandak.medium.com/power-bi-dax-function-networkdays-5c8e4aca38c

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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