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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mady90
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 filterdate filter

 

dates being returned and counteddates being returned and counted

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



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

Hi @mady90 ,

 

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)

If I misunderstood it, could you please share your sample data and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

 

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

1 REPLY 1
v-xicai
Community Support
Community Support

Hi @mady90 ,

 

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)

If I misunderstood it, could you please share your sample data and desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

 

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

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.