In a Quick Sight 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:
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?
However, I cannot add it it my table (or any other visualization for that matter). I think it’s because {bmi} is not an aggregated string value – which is ironically a requirement to aggregate the string itself.
And even trying to aggregate it says it’s not the correct data type and errors out At least one of the arguments in this function does not have correct type. Correct the expression and choose Create again. , e.g., lastValue(min({bmi}), [{measure_date} ASC], [{patient_ID}])
Hi - yeah keep this open. If I can’t use MAX() on a string then this should become a feature request. There’s no answer I’m willing to approve at this time. I had to go back to my SQL and change all string values to a number, perform aggregations on those numeric values, and then add calculated field lookup tables to get them back into a string format.
Hi @teuszie,
No problem, I’ll mark this as a feature request to promote visibility to the AWS support team.
If you have any additional notes/comments to add for the feature request; feel free to add below. Otherwise I’ll close out this topic in 3 business days if we do not hear back further.
Hi @teuszie,
Since this has been tagged as a feature request and we have not heard back further, I’ll go ahead and close this for the support team to review.
If you have any additional questions, feel free to create a new post in the community.