Hi everyone,
I’m trying to create a KPI in Amazon QuickSight that shows the average of the maximum progress per session. Each session has multiple progress entries, and I want to first find the maximum progress for each session and then take the average of those maximum values across all sessions.
Here’s what I’ve tried so far:
- Using
maxOver
to Calculate Maximum Progress Per Session:
-
I created a calculated field called
Max Progress per Session
using:maxOver({progress}, [{session_id}], PRE_AGG)
-
This correctly gives me the maximum progress for each session but retains a row for each entry in the session, not just one unique row per session.
- Attempting to Use
sumOver
withmaxOver
:
-
I tried to use
sumOver(maxOver({progress}, [{session_id}], PRE_AGG), {session_id})
to calculate the sum of unique maximum progress values per session, but I encountered an error:Expression sumOver(maxOver({progress}, [{session_id}], PRE_AGG), {session_id}) has incorrect argument type sumOver(Number, String). Function syntax expects Numeric, List, Calculation Level.
-
And if I add PRE_AGG it sums the duplicated rows, so this approach didn’t work.
- Using
denseRank
for Deduplication:
-
I also tried to use
denseRank
to rank the entries within each session and keep only the first row per session:denseRank([{session_id}])
-
However, I encountered syntax errors when trying to use
denseRank
with a specific sort order, likedenseRank([{session_id}], [{progress} DESC])
.
- Current Status:
- I can display the maximum progress for each session, but I haven’t found a way to calculate the average of these maximums without QuickSight duplicating rows within each session.
- I tried adding
Max Progress per Session
to the KPI and then calculatingavg({Max Progress per Session})
, but this averages all rows, leading to incorrect results because of the retained rows for each session.
What I’d like is for the KPI to display the correct average of unique maximum progress values per session. Has anyone managed to achieve this in QuickSight or know of a workaround for this kind of nested aggregation or distinct averaging?
Thanks in advance for any suggestions!