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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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