cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Calculating date difference of a dynamic slicer table

I have two tables

Date table: Date

Product Table: product ID, Timestamp

The tables have an 1:M relation with cross filtering set to "both"

I have a slicer in a tab and I want to get the date difference between those two tabs. But I am getting wrong values because of my cross filtering criteria. I have tried DAX but I am unable to get the correct answer here.

If I try Dax to get Max date and Min date, it shows max date as 2020 and Min date as 2000. It does not give me the max and min dates of that slicer, Any help would be greatly appreciated here.

date filter

dates being returned and counted

```Days Measured=CALCULATE(COUNTROWS(CalendarDate),ALLSELECTED())

testmaxdate = CALCULATE(MAX(CalendarDate[CalendarDate].[Date]),ALLSELECTED(CalendarDate))```
1 ACCEPTED SOLUTION
Community Support

You can create measures to get Max date and Min date of date slicer, as well the date difference , like DAX below:

```Max date = CALCULATE(MIN(CalendarDate[Date]),ALLSELECTED(CalendarDate[Date]))

Min date = CALCULATE(MAX(CalendarDate[Date]),ALLSELECTED(CalendarDate[Date]))

DateDiff= DATEDIFF([Min date], [Max date], DAY)```

Best Regards,

Amy

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

Community Support

You can create measures to get Max date and Min date of date slicer, as well the date difference , like DAX below:

```Max date = CALCULATE(MIN(CalendarDate[Date]),ALLSELECTED(CalendarDate[Date]))

Min date = CALCULATE(MAX(CalendarDate[Date]),ALLSELECTED(CalendarDate[Date]))

DateDiff= DATEDIFF([Min date], [Max date], DAY)```

Best Regards,

Amy

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

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors