Forum Discussion

ryan_b_fiting's avatar
ryan_b_fiting
Icon for Post Patron rankPost Patron
3 years ago
Solved

Return Data based on the most recent date

Hello Community -    I am in need of some urgent assistance on a DAX issue I am having.  I am looking for a measure(s) that will return a patients last visit date and another that will return the p...
  • v-yinliw-msft's avatar
    3 years ago

    Hi ryan_b_fiting,

     

    You can try this method:

    New two measures:

    Last Visit =
    CALCULATE (
        MAX ( 'Appointment'[Visit Date] ),
        FILTER ( 'Appointment', 'Appointment'[PatientID] )
    )
    
    Last Visit Type =
    CALCULATE (
        MAX ( Appointment[Visit Type] ),
        FILTER ( 'Appointment', 'Appointment'[Visit Date] = [Last Visit] )
    )
    

    Then in table visual:

     

     

     

     

    Hope this helps you. Here is my PBIX file.

     

    Best Regards,

    Community Support Team _Yinliw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.