Forum Discussion
Patient Tracker and Package Tracker
Hi,
I have two excel sheets one in which patient attendance is tracked with which therapist has been attended. Another sheet that says the type of package that the patients has bought.
Every day I need to calculate the revenue by each Therapist. I have attached both the sheets, to show the type of data that is being generated from the system.
From the software that we use we can generate the patient attendance tracker in excel (csv format).
I would like to know can MS Access help me. The attendance sheet needs to be generated at the end of the day every day and needs to uploaded to MS Access, how will I be able to do that
Patient Attendance Tracker
Patient Name | Patient ID | Therapist | Department | Date |
Shyam Hani | 153 | Ryaan | Occupational Therapy | 02/10/2024 |
Shyam Hani | 153 | Ryaan | Occupational Therapy | 04/09/2024 |
Shyam Hani | 153 | Ryaan | Occupational Therapy | 06/09/2024 |
Shyam Hani | 153 | Sanju | Speech Therapy | 02/10/2024 |
Shyam Hani | 153 | Sanju | Speech Therapy | 04/09/2024 |
Shyam Hani | 153 | Sanju | Speech Therapy | 05/10/2024 |
Shyam Hani | 153 | Sanju | Speech Therapy | 06/09/2024 |
Shyam Hani | 153 | Sanju | Speech Therapy | 07/09/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 09/10/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 09/10/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 10/08/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 11/09/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 11/09/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 11/10/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 11/10/2024 |
Meera Hasan | 152 | Sanju | Speech Therapy | 12/10/2024 |
Dev Mani | 112 | Sanju | Occupational Therapy | 01/10/2024 |
Dev Mani | 112 | Sanju | Occupational Therapy | 02/10/2024 |
Dev Mani | 112 | Sanju | Occupational Therapy | 04/10/2024 |
Dev Mani | 112 | Sanju | Occupational Therapy | 08/10/2024 |
Dev Mani | 112 | Sanju | Occupational Therapy | 09/10/2024 |
Dev Mani | 112 | Sanju | Occupational Therapy | 10/09/2024 |
Dev Mani | 112 | Sanju | Occupational Therapy | 10/10/2024 |
Dev Mani | 112 | Ryaan | Occupational Therapy | 11/09/2024 |
Dev Mani | 112 | Ryaan | Occupational Therapy | 11/10/2024 |
Dev Mani | 112 | Ryaan | Occupational Therapy | 12/09/2024 |
Dev Mani | 112 | Ryaan | Occupational Therapy | 01/10/2024 |
Dev Mani | 112 | Ryaan | Occupational Therapy | 04/10/2024 |
Dev Mani | 112 | Ryaan | Occupational Therapy | 08/10/2024 |
Dev Mani | 112 | Ryaan | Occupational Therapy | 10/10/2024 |
Patient Price Tracker
Patient Name | Therapist | Patient ID | Package From | Package To | Package Price | Package |
Shyam Hani | Sanju | 153 | Wednesday, 2 October 2024 | Wednesday, 4 September 2024 | 100 | Speech Therapy |
Shyam Hani | Ryaan | 153 | Wednesday, 2 October 2024 | 0 | Occupational Therapy | |
Meera Hasan | Sanju | 152 | Wednesday, 9 October 2024 | Saturday, 12 October 2024 | 200 | Occupational Therapy |
Dev Mani | Sanju | 112 | Tuesday, 1 October 2024 | Tuesday, 8 October 2024 | 300 | Occupational Therapy |
Dev Mani | Ryaan | 112 | Saturday, 27 July 2024 | Tuesday, 27 August 2024 | 400 | Occupational Therapy |
8 Replies
- Ken_SheridanCopper Contributor
You don't need to import your Excel files into tables in Access. You can link to them, which will mean the database will always reflect updates of the data in the Excel files. You can then return the pro rata income per therapist per day with the following query:
SELECT [Patient Attendance Tracker].[Date], [Patient Attendance Tracker].Therapist,
SUM([Package Price]/((Nz([Package to],DATE())-[Package From])+1)) AS [Pro rata daily income]
FROM [Patient Attendance Tracker] LEFT JOIN [Patient Price Tracker]
ON ([Patient Attendance Tracker].[Date]>= [Patient Price Tracker].[Package From])
AND ([Patient Attendance Tracker].[Date] < [Patient Price Tracker].[Package To]+1 )
AND ([Patient Attendance Tracker].Department = [Patient Price Tracker].Package)
AND ([Patient Attendance Tracker].Therapist = [Patient Price Tracker].Therapist)
GROUP BY [Patient Attendance Tracker].[Date], [Patient Attendance Tracker].Therapist;
This will return the pro rata income per therapist per date for those dates where a patient has an attendance date within a range specified for the therapist in a row in [Patient Price Tracker]. With the data in the two Excel files you posted this is not always the case, so a therapist's name will be returned for a date, but with a Null at the [Pro rata daily income] column position. Also, in one case the range has a start date later than its end date.
If you wish to return rows for all dates, in addition to those returned by the above query, then you'd need to include an auxiliary Calendar table in the query as follows:
SELECT Calendar.calDate, [Patient Attendance Tracker].Therapist,
SUM([Package Price]/((NZ([Package to],DATE())-[Package From])+1)) AS [Pro rata daily income]
FROM Calendar LEFT JOIN ([Patient Attendance Tracker] LEFT JOIN [Patient Price Tracker]
ON ([Patient Attendance Tracker].[Date]>= [Patient Price Tracker].[Package From])
AND ([Patient Attendance Tracker].[Date]< [Patient Price Tracker].[Package To]+1 )
AND ([Patient Attendance Tracker].Department = [Patient Price Tracker].Package)
AND ([Patient Attendance Tracker].Therapist = [Patient Price Tracker].Therapist))
ON Calendar.calDate = [Patient Attendance Tracker].[Date]
GROUP BY Calendar.calDate, [Patient Attendance Tracker].Therapist;
For means of generating auxiliary calendar tables take a look at Calenadr.zip in my public databases folder at:
https://onedrive.live.com/?id=44CC60D7FEA42912%21169&cid=44CC60D7FEA42912
This little demo file you'd use the Daily Calendar option, and possibly exclude weekends and/or public holidays, for which the demo includes provision.
- peiyezhuBronze Contributor
sql:
select * from Sheet2;
select * from Sheet1;
select Sheet2.f03,sum(f06) from Sheet2 join Sheet1 on Sheet2.f02=Sheet1.f03 and Sheet2.f03=Sheet1.f02 group by Sheet2.f03;
f01 f02 f03 f04 f05 Shyam Hani 153 Ryaan Occupational Therapy 02/10/2024 Shyam Hani 153 Ryaan Occupational Therapy 04/09/2024 Shyam Hani 153 Ryaan Occupational Therapy 06/09/2024 Shyam Hani 153 Sanju Speech Therapy 02/10/2024 Shyam Hani 153 Sanju Speech Therapy 04/09/2024 Shyam Hani 153 Sanju Speech Therapy 05/10/2024 Shyam Hani 153 Sanju Speech Therapy 06/09/2024 Shyam Hani 153 Sanju Speech Therapy 07/09/2024 Meera Hasan 152 Sanju Speech Therapy 09/10/2024 Meera Hasan 152 Sanju Speech Therapy 09/10/2024 Meera Hasan 152 Sanju Speech Therapy 10/08/2024 Meera Hasan 152 Sanju Speech Therapy 11/09/2024 Meera Hasan 152 Sanju Speech Therapy 11/09/2024 Meera Hasan 152 Sanju Speech Therapy 11/10/2024 Meera Hasan 152 Sanju Speech Therapy 11/10/2024 Meera Hasan 152 Sanju Speech Therapy 12/10/2024 Dev Mani 112 Sanju Occupational Therapy 01/10/2024 Dev Mani 112 Sanju Occupational Therapy 02/10/2024 Dev Mani 112 Sanju Occupational Therapy 04/10/2024 Dev Mani 112 Sanju Occupational Therapy 08/10/2024 Dev Mani 112 Sanju Occupational Therapy 09/10/2024 Dev Mani 112 Sanju Occupational Therapy 10/09/2024 Dev Mani 112 Sanju Occupational Therapy 10/10/2024 Dev Mani 112 Ryaan Occupational Therapy 11/09/2024 Dev Mani 112 Ryaan Occupational Therapy 11/10/2024 Dev Mani 112 Ryaan Occupational Therapy 12/09/2024 Dev Mani 112 Ryaan Occupational Therapy 01/10/2024 Dev Mani 112 Ryaan Occupational Therapy 04/10/2024 Dev Mani 112 Ryaan Occupational Therapy 08/10/2024 Dev Mani 112 Ryaan Occupational Therapy 10/10/2024 f01 f02 f03 f04 f05 f06 f07 Shyam Hani Sanju 153 Wednesday, 2 October 2024 Wednesday, 4 September 2024 100 Speech Therapy Shyam Hani Ryaan 153 Wednesday, 2 October 2024 Occupational Therapy Meera Hasan Sanju 152 Wednesday, 9 October 2024 Saturday, 12 October 2024 200 Occupational Therapy Dev Mani Sanju 112 Tuesday, 1 October 2024 Tuesday, 8 October 2024 300 Occupational Therapy Dev Mani Ryaan 112 Saturday, 27 July 2024 Tuesday, 27 August 2024 400 Occupational Therapy f03 sum(f06) Ryaan 2800 Sanju 4200 - peiyezhuBronze ContributorPlease show your expected result based on these two sheets from the OP.
- team280Copper Contributor
arnel_gp - Sure.
I am not able to attach the file.
The files are available in the below link : https://drive.google.com/drive/folders/1aHwTywzUsu8GL6v6uk_UPKn76zZGctOE?usp=drive_link
- George_HepworthSilver Contributor
That link requires a login to retrieve the file, does it not?