"We aim to generate a calculated field based on existing data with the following fields:
- Visit Date: Represents the date of a person’s visit
- Patient ID: A unique identifier for each patient…
- Rank Appointment: Indicates the rank of the visit (1 for the first visit, 2 for the second, and so on).
We have two parameters derived from the Visit Date: Start Date and End Date.
The goal is to create a calculated field that behaves as follows:
- If the first visit is present within the selected time frame, display the second visit.
- If the first visit is not present in the selected time frame, do not show the second visit."
Hi Abhishek_24,
for native SQL I would take a code like this:
SELECT
VisitDate,
PatientID,
ROW_NUMBER() OVER (
PARTITION BY PatientID
ORDER BY VisitDate
) AS RankAppointment
FROM
YourTableName;
So for a calculated Filed in QuickSight you should use DenseRank Function
[https://docs.aws.amazon.com/quicksight/latest/user/denseRank-function.html]
Hi @Johannes03 Thanks for the suggestion,
is there anyway i can achieve it by calculated field, as by sql it isn’t helping me what i want to get.
ErikG
4
Hi @Abhishek_24
did you solve your problem?
BR
Yes, but by different approach.
ErikG
6
Ok. Great. Could you close the topic please?
duncan
7
Hello @Abhishek_24 !
Would you be able to share your solution to be help the community in case another user runs into this as well?
Asem
8
Hi @Abhishek_24,
I am marking this post as solved, but please do share your solution if you can.
Thank you.