Forum Discussion

newkingdom's avatar
newkingdom
Frequent Visitor
7 years ago
Solved

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. 

5 Replies

  • newkingdom's avatar
    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

      • newkingdom's avatar
        newkingdom
        Frequent Visitor

        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?