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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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) ) )

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.