Forum Discussion
Calculate 3rd Opening
- 6 years ago
Hi TabathaN
Create three measures
Measure = MAX('Table'[Appointment Date]) 3rd Next Avail = CALCULATE ( MAX ( 'Table'[Appointment Date] ), TOPN ( 3, FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Scheduling Provider] = MAX ( 'Table'[Scheduling Provider] ) && FIND ( "Open", 'Table'[Appointment Status], 1, 0 ) > 0 ), [Measure], ASC ) ) 3rd Next New Patient = CALCULATE ( MAX ( 'Table'[Appointment Date] ), TOPN ( 3, FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Scheduling Provider] = MAX ( 'Table'[Scheduling Provider] ) && FIND ( "Open", 'Table'[Appointment Status], 1, 0 ) > 0 && 'Table'[Appointment Type] = "New Patient" ), [Measure], ASC ) )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
While I was working on your question Power BI produced one of its marvelous surpsizes
I added a Doctor dimension and a Status dimension table
Then I put the appoint table on a report and created a slicer for doctor and a slicer for status
Without adding any DAX you can now filter by doctor and status, or just by doctor, or just by status. This version is more powerful than what you asked for.... but I thought it might be very helpful
If you'd still like a dax measure to get the next 2 open appointments let me know and I can write that for you.
I'm a personal Power BI trainer. Every time I answer a question I learn something new.
- TabathaN6 years agoAdvocate III
thank you kentyler ! I definitely will use the slicer functionality but here's what I'm thinking...
I would like the visual to list the singular record of the 3rd next available date rather than users having to look and figure it out.
Provider 3rd Next Avail Dr A 1/3/2020 Dr B 2/10/2020 Dr C 3/3/2020 And then whether we would need to create a second visual, or add slicer to say "ok, now what is the 3rd next New Patient, not just overall 3rd next". So kinda looking for two things but priority is the overall 3rd next avail. Does that make sense?
Provider 3rd Next New Patient Dr A 3/2/2020 Dr B 2/28/2020 Dr C 5/15/2020 - kentyler6 years agoSolution Sage
OK
So if the user selects a Doctor who as 6 future openings, you want a single card that displays the date of the 3rd of those openings, but not the 1st or 2nd ?
- v-juanli-msft6 years agoCommunity Support
Hi TabathaN
Create three measures
Measure = MAX('Table'[Appointment Date]) 3rd Next Avail = CALCULATE ( MAX ( 'Table'[Appointment Date] ), TOPN ( 3, FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Scheduling Provider] = MAX ( 'Table'[Scheduling Provider] ) && FIND ( "Open", 'Table'[Appointment Status], 1, 0 ) > 0 ), [Measure], ASC ) ) 3rd Next New Patient = CALCULATE ( MAX ( 'Table'[Appointment Date] ), TOPN ( 3, FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Scheduling Provider] = MAX ( 'Table'[Scheduling Provider] ) && FIND ( "Open", 'Table'[Appointment Status], 1, 0 ) > 0 && 'Table'[Appointment Type] = "New Patient" ), [Measure], ASC ) )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.