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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Rafaelhk
Frequent Visitor

Datediff using allselected and slicer

I have a database that compiles information received from several organization and I have to keep track on how many days has passed since the last submission.

 

I am doing it using this measure:

Overall last submission date = calculate(MAX(Submissions[last_submission_date]), ALLSELECTED(Submissions))

 

And then the min of this column

Days from last submissoin= DATEDIFF(Submissions[last_submission_date], Submissions[Overall last submission date], DAY)
 
 
When not filtered, the result is as expected:
OrganizationLast submission DateOverall last submission DateDays from last submission
A14/8/202219/9/202236
B19/9/202219/9/20221
 
The problem is when I filter the submission by year, using a slicer:
Expected:
OrganizationLast submission DateOverall last submission DateDays from last submission
A31/12/202131/12/20210
B31/12/202131/12/20210
 
What I get:
OrganizationLast submission DateOverall last submission DateDays from last submission
A31/12/202131/12/2021262
B31/12/202131/12/2021262
 
Any thoughts on why this is happening?
 
 
1 ACCEPTED SOLUTION

@amitchandak ,

 

Thank you for the reply. Although your formula did not work, you pointed me in the right direction.

 

This is the formular that worked:

 
Days from last submission = CALCULATE(DATEDIFF(MAX(Submissions[last_submission_date]),Submissions[Overall last submission date], DAY))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Rafaelhk , The second one needs to be a measure too

 

Days from last submissoin= DATEDIFF(Max(Submissions[last_submission_date]), Submissions[Overall last submission date], DAY)

 

 

sumx(values(Submissions[Organization]) ,calculate(DATEDIFF(Max(Submissions[last_submission_date]), Submissions[Overall last submission date], DAY) ) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak ,

 

Thank you for the reply. Although your formula did not work, you pointed me in the right direction.

 

This is the formular that worked:

 
Days from last submission = CALCULATE(DATEDIFF(MAX(Submissions[last_submission_date]),Submissions[Overall last submission date], DAY))

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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