Forum Discussion
get a value from a column for a specific client based on first and last date
Hi There,
I have a table where clients had different appoiments in different dates. At each appoiment they have two scores ( Gad7 and PHQ9).
I want to calculate or show another column for each Client ID the GAD7 score and PHQ9 Score at first and last appoiment.
THis is my table.
| LPTID | APPOINTMENT | PHQ9_SCORE | GAD7SCORE |
| 667653 | 12/01/2018 14:30 | 48 | 19 |
| 667653 | 18/01/2018 15:00 | 34 | 20 |
| 667653 | 16/01/2018 14:50 | 48 | 19 |
| 691677 | 06/11/2018 13:00 | 55 | 76 |
| 691677 | 03/12/2018 09:00 | 33 | 23 |
| 842875 | 04/01/2018 10:00 | 37 | 38 |
| 842875 | 18/01/2018 11:00 | 37 | 23 |
| 843848 | 07/09/2018 18:00 | 40 | 42 |
| 843848 | 21/09/2018 18:30 | 14 | 14 |
| 847455 | 05/01/2018 10:00 | 37 | 42 |
| 847455 | 18/01/2018 12:00 | 40 | 38 |
| 848754 | 11/10/2018 17:00 | 40 | 42 |
| 851821 | 25/05/2018 11:00 | 55 | 76 |
| 851821 | 01/06/2018 13:00 | 51 | 66 |
And this is my output
| LPTID | APPOINTMENT | PHQ9 first App | GAD7 first APP | PHQ9 Last App | GAD7 last APP |
| 667653 | 12/01/2018 14:30 | 48 | 19 | 48 | 19 |
| 691677 | 06/11/2018 13:00 | 55 | 76 | 33 | 23 |
| 842875 | 04/01/2018 10:00 | 37 | 38 | 37 | 23 |
| 843848 | 07/09/2018 18:00 | 40 | 42 | 14 | 14 |
| 847455 | 05/01/2018 10:00 | 37 | 42 | 40 | 38 |
| 851821 | 25/05/2018 11:00 | 55 | 76 | 51 | 66 |
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
All measures are in the attached pbix file.
2 Replies
- Jihwan_Kim
Super User
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
All measures are in the attached pbix file.
- v-easonf-msft
Community Support
Hi, mihaita_baro
If your problem has been solved, please mark the helpful replies or add your reply as Answered to close this thread.
It will help other community members easily find the solution when they get the similar issue.Best Regards,
Community Support Team _ Eason