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
TBSST
Frequent Visitor

Datediff and using date filter on page

Hi all, 

 

i am trying to calculate number of clients who have gone a certain number of days without a service. Below is the table i am working with. 

 

ClientService DateExit Date
11/01/20231/02/2023
16/01/20231/02/2023
21/02/20231/03/2023
31/03/20231/05/2023
36/04/20231/05/2023
41/04/20231/05/2023
51/05/20231/06/2023
51/06/20231/06/2023
61/06/20231/07/2023
71/07/2023 
71/08/2023 
81/08/2023 

My current dax is calculating the datediff between the service date and and todays date, and the exit date and todays date, and if the service period is over 120 days, it counts the client, and if the client had left outside of 120 days since last service, they will be counted. 

 

My issue is i am using the service date on the page to identify active clients during a period of time, which means when the Datediff is calculating the start date, its counting from the last service of the service date and todays date. Meaning if the service date filter page is set to looking at clients with an activity from 1/1/23 - 1/4/23, instead of client one only having 90 days (As set as the service date filter), its counted as having 240 days, so its been counted as overdue, even though during the selected period of time, they would of still been in date. 

 

How can i have the "date2" in datediff linked to the page filtered date, instead of having it as TODAYS()?

 

   Var Filtered = FILTER(Table1, Table1[Client] in {"Filter1"})
    Var ClientMaxDate = SUMMARIZE(Filtered,
      Table1[Client],
        "overdue", DATEDIFF(MAX(Table1[Servicedate]), TODAY(), DAY),
        "Exit", IF(ISBLANK(MAX(Table1[ExitDate])), DATEDIFF(MAX(Table1[Servicedate]), TODAY(), DAY), DATEDIFF(MAX(Table1[Servicedate]), Table1[ExitDate]), DAY)))
    Var OverdueClients = FILTER(ClientMaxDate, [overdue] >=120 && [Exit] >=120)
    Return
      COUNTROWS(OverdueClients)
 

Thank you for your suppport. 

1 REPLY 1
lbendlin
Super User
Super User

what is an "activity"?  them having a service event?

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.