Hello Quick Sight Community,
I am facing an issue with calculating the median of “Number of days to close the case” for unique CaseIDs in Quick Sight.
Dataset Overview: My dataset consists of CaseIDs, each with associated “Number of days to close the case.”
Some CaseIDs appear multiple times with identical numbers of days due to how the data model is structured.
Here’s a sample of the data:
| CaseID | Number of days to close the case |
|---|---|
| C1 | 2 |
| C1 | 2 |
| C2 | 4 |
| C2 | 4 |
| C3 | 5 |
| C4 | 8 |
| C5 | 6 |
Goal: I need to calculate the median number of days it takes to close cases, considering each CaseID uniquely.
Approach and Issue: To handle duplicate CaseIDs with the same number of days, I used minOver in the data preparation step to ensure each CaseID is considered only once:
minOver({Number of days to close the case}, [{CaseID}], PRE_AGG)
Despite this, the KPI card in Quick Sight shows a median of 4, whereas the correct median calculated manually from the unique dataset (2, 4, 5, 6, 8) is 5.
Thank you in advance for your help!
