Hi,
I have an example dataset of weight data which captures users and their weights at most once per day:
|— | — | —|
|Patient_ID | weight | measure_date|
|abc1 | 170.0 | 2025-01-01|
|abc1 | 175.0 | 2025-02-15|
|abc1 | 172.0 | 2025-03-20|
In a QuickSight analysis table, I can use minOver and maxOver functions to capture the first and last weights and dates per patient. I can visualize these in a table:
|— | — | — | —|
|patient_ID | first_weight | last_weight | first_measurement | last_measurement|
|abc1 | 170.0 | 172.0 | 2025-01-01 | 2025-03-20|
Now suppose I have a string field in the original table named “bmi”:
|— | — | —|
|Patient_ID | weight | measure_date | bmi|
|abc1 | 170.0 | 2025-01-01 | normal|
|abc1 | 175.0 | 2025-02-15 | overweight|
|abc1 | 172.0 | 2025-03-20 | overweight|
Is there a way to aggregate the bmi strings in a similar way as numerics and dates?
|— | — | — | —|
|patient_ID | first_weight | last_weight | first_measurement | last_measurement | first_bmi | last_bmi|
|abc1 | 170.0 | 172.0 | 2025-01-01 | 2025-03-20 | normal | overweight|
As it’s currently setup I can capture the first BMI in the range:
ifelse({measure_date} = {parameter_capturing_first_date}, {bmi}, NULL)
I can also create similar for the last BMI:
ifelse({measure_date} = {parameter_capturing_last_date}, {bmi}, NULL)
However, the last value appears as NULL in my table:
|— | — | — | —|
|patient_ID | first_weight | last_weight | first_measurement | last_measurement | first_bmi | last_bmi|
|abc1 | 170.0 | 172.0 | 2025-01-01 | 2025-03-20 | normal | null|
This is because the last_bmi would be captured on a different row under the hood.
So my question is: is there a way to aggregate the last bmi string here in such a way that it “shows up on the same row” as the first_bmi value given the aggregation I’m hoping for?