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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
newkingdom
Frequent Visitor

Difference between last date and next one

Hi, I am completely new to power bi. I have a table with appointments for customers by their id. each id number can have multiple appointment dates.

 

i am trying to find the number of days since the last appointment the patient had and their next appointment. 

Please tell me how I can achieve that. Thank you. 

1 ACCEPTED SOLUTION

Hi,

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
newkingdom
Frequent Visitor

 data   results    
          
 iddate  iddays from last appointment to today
 1018/20/2019  1017   
 1018/21/2019  10232   
 1018/22/2019  10362   
 1018/29/2019       
 1028/24/2019       
 1028/25/2019       
 1029/26/2019       
 1038/27/2019       
 1038/28/2019       
 1038/29/2019       
 10310/30/2019       
          

 

 

Something along the lines of this basically

Hi,

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you so much. Just a a follow up though, some of the tables only had one date and so the numbers are huge, like 43000. How can I add the condition that if 2ndlastday does not exist, then do not subtract or maybe just return the date?

Hi,

Try this measure

=IF(ISBLANK([Second last date]),BLANK(),[Days since previous appointment])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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