I am struggling to see a difference in the outputs of the two expressions below. I would be grateful if anyone could enlighten me if there is one. Basically, I want to take one value of (today-discharged_date) for each unique value of claim_identifier and get the median of those that have a claim_status_description of "Awaiting Consultant Claim" or "Awaiting Consultant Invoice".
There is only one discharged_date for each unique claim_id
In the expression below I have summed all the values of (today()-discharged_date) where the claim_status_description is "Awaiting Consultant Claim", "Awaiting Consultant Invoice", these sums are then grouped by unique Claim_Identifier and then the median of these values calculated.
Grouping the sums is the problem and is giving me a value that is too high.
In the expression below I am grouping the values of (today()-discharged_date) by unique Claim_Identifier. Then I am getting the median of those values where the claim_status_description is "Awaiting Consultant Claim", "Awaiting Consultant Invoice". This appears to be giving me more sensible answers for my problem.