cancel
Showing results for
Did you mean:
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

Accepted Solutions
Post Patron

## Re: Only count business days in date diff count

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

TotalDaysWOWeekends =
VAR MyDates =
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 ) )

7 REPLIES 7
Super User III

## Re: Only count business days in date diff count

Try this Column

```TotalDaysWOWeekends =
VAR MyDates =
GENERATESERIES ( TableName[StartDate] + 1, TableName[EndDate] ),
"Day", WEEKDAY ( [Value], 2 )
)
RETURN
COUNTROWS ( FILTER ( mydates, [Day] <= 5 ) )```
Try my new Power BI game Cross the River
Super User III

## Re: Only count business days in date diff count

@kattlees

Try my new Power BI game Cross the River
Post Patron

## Re: Only count business days in date diff count

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

TotalDaysWOWeekends =
VAR MyDates =
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 ) )

Super User III

## Re: Only count business days in date diff count

@kattlees

See my file attached here

You could share your file with me

VALUE is the column created by GenerateSeries function

Try my new Power BI game Cross the River
Super User III

## Re: Only count business days in date diff count

@kattlees

May be you have some BLANK dates

Try my new Power BI game Cross the River
Highlighted
Super User III

## Re: Only count business days in date diff count

@kattlees

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

See the pic below

Try my new Power BI game Cross the River
Post Patron

## Re: Only count business days in date diff count

Thank you so much! This worked perfectly.

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors