cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Measure to calculate the number of days between two dates in a date slider

I have a date slicer, say values of 1/1/17 to 1/21/17.  I would like a simple measure of the number of days between those two dates (i.e. 20).  I want to used that measure to create a number of visuals based on the number of days selected in the slider.  If it's 1/1/16 to 1/2/17, I want the measure to return 366 days.  Hope this makes sense.  Seems like it should be an easy one.  Appreciate your help!!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft

## Re: Measure to calculate the number of days between two dates in a date slider

Please try the following calculated measure. Just substitute the table/date column you are using in your slicer.

```Days Between = DATEDIFF(
MIN('Table'[Date]),
MAX('Table'[Date]),
DAY
)```

Proud to be a Datanaut!

3 REPLIES 3
Highlighted
Microsoft

## Re: Measure to calculate the number of days between two dates in a date slider

Please try the following calculated measure. Just substitute the table/date column you are using in your slicer.

```Days Between = DATEDIFF(
MIN('Table'[Date]),
MAX('Table'[Date]),
DAY
)```

Proud to be a Datanaut!

Highlighted
Regular Visitor

## Re: Measure to calculate the number of days between two dates in a date slider

Hello,

How about returning just business days M-F

Thanks

Highlighted
Microsoft

## Re: Measure to calculate the number of days between two dates in a date slider

One way is to keep a column in your Date Table that carries just 1's and 0's.  Set weekend values (and holidays if you can) to 0. That way you can just SUM the column between the dates you care about and that should hopefully give you the number you need.

Proud to be a Datanaut!

Announcements

#### Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

#### August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

#### July 2020 Community Highlights

Learn about the exciting things that happened in July.

#### Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

#### Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors