Forum Discussion

Williams25k's avatar
Williams25k
Frequent Visitor
1 year ago
Solved

LOOKUPVALUE with multiple return values

I have two different tables. One serves as a master list of all ID numbers for a group of people.    The other table has appointment information of those ID numbers. In the appointment table, the I...
  • PhilipTreacy's avatar
    1 year ago

    Hi Williams25k 

     

    Download PBIX file with example below

     

    Does your Type column look something like this (the actual text in the Type column has no bearing on the measures) :

     

    If so you can write 2 measures

     

    Last Completed Type = CALCULATE(MAX('NY Appt Master'[Type]), FILTER(('NY Appt Master'), 'NY Appt Master'[ID] = SELECTEDVALUE('NY Appt Master'[ID]) && 'NY Appt Master'[Start Date] = [Last Completed Appt]))
    Next Appt Type = CALCULATE(MAX('NY Appt Master'[Type]), FILTER(ALL('NY Appt Master'), 'NY Appt Master'[ID] = SELECTEDVALUE('NY Appt Master'[ID]) && 'NY Appt Master'[Start Date] = [Next Appt]))

     

     

    and display them in a table

     

    For the 2nd part, with the sample data I have, there are 4 people with previous appointments and 4 people with scheduled appointments, but there are 5 people.  So your measure will give you 100% (4/4) but is this what you really want to?  Are you actually interested in measuring Prev/Scheduled appointments against the total number of people?

     

    Anyway, this will give you what you actually asked for above, if it's not what you are after, let me know

     

     

    Perc People With Prev & Next Appt = DIVIDE(CALCULATE(DISTINCTCOUNT('NY Appt Master'[ID]), FILTER('NY Appt Master', 'NY Appt Master'[Status] = "Comp")), CALCULATE(DISTINCTCOUNT('NY Appt Master'[ID]), FILTER('NY Appt Master', 'NY Appt Master'[Status] = "Scheduled")))

     

     

    Regards

     

    Phil