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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.