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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
kattlees
Post Patron
Post Patron

Only count business days in date diff count

I need to run a report to see how long it takes something to be done.

 

I have 

StartDate and EndDate columns and can use a DateDiff(EndDate,StartDate) to get total days it took. 


What I would like to do is be able to NOT count weekend days in the count. So example would be

 

StartDate               EndDate            ActualTotalDays               TotalDaysWOWeekends

1/31/2018              2/2/2018                     2                                           2

2/2/2018                2/7/2018                    5                                            3  (not counting 2-3 & 2-4)

1 ACCEPTED SOLUTION

Does something go in [Value] area?  Here is my formula  and I get "The arguments in GenerateSeries function cannot be blank

 

TotalDaysWOWeekends =
VAR MyDates =
ADDCOLUMNS (
GENERATESERIES ( V_ACCT[visit_disch_date] + 1, V_ACCT[V_ACCT_HIM_Grouper.ipg_mrcomp_date] ),
"Day", WEEKDAY ( [Value], 2 )
)
RETURN
COUNTROWS ( FILTER ( mydates, [Day] <= 5 ) )

View solution in original post

7 REPLIES 7
Zubair_Muhammad
Community Champion
Community Champion

HI @kattlees

 

Try this Column

 

TotalDaysWOWeekends =
VAR MyDates =
    ADDCOLUMNS (
        GENERATESERIES ( TableName[StartDate] + 1, TableName[EndDate] ),
        "Day", WEEKDAY ( [Value], 2 )
    )
RETURN
    COUNTROWS ( FILTER ( mydates, [Day] <= 5 ) )

Regards
Zubair

Please try my custom visuals

Does something go in [Value] area?  Here is my formula  and I get "The arguments in GenerateSeries function cannot be blank

 

TotalDaysWOWeekends =
VAR MyDates =
ADDCOLUMNS (
GENERATESERIES ( V_ACCT[visit_disch_date] + 1, V_ACCT[V_ACCT_HIM_Grouper.ipg_mrcomp_date] ),
"Day", WEEKDAY ( [Value], 2 )
)
RETURN
COUNTROWS ( FILTER ( mydates, [Day] <= 5 ) )

Thank you so much! This worked perfectly.

@kattlees

 

Your formula seems correct

 

See my file attached here

 

You could share your file with me

 

VALUE is the column created by GenerateSeries function


Regards
Zubair

Please try my custom visuals

@kattlees

 

May be you have some BLANK dates


Regards
Zubair

Please try my custom visuals

@kattlees

 

Yes I get this error when I make any of the dates is BLANK

See the pic below

 

DayExcludingWeekEndsErr.png


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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