Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Median without AGGR: Performance Issues

Hi All,

In my dashboard i am calculating median value for No of days spent at hospital for patients as per the drugs,

So the metric which i am using is :

median(aggr([No of days],Patient,Drug))

But this is really killing the performance of my dashboard.

Does anyone has any other alternative for this median calculations without using AGGR functions.

Regards

Khushboo

21 Replies
sunny_talwar

Do you have duplicate rows for No of days for a combination of Patient and Drug? This alone isn't working? Median(No of days])

Not applicable
Author

No this alone wont work because we need median at patient level for each product.

sunny_talwar

Do you have a sample you can share?

jonathandienst
Partner - Champion III
Partner - Champion III

If you have a table with Patient and Drug as dimensions, then the simple =Median([No of days]) will do what you require.

If you use a straight table, you can then decide how to handle the total (an expression total is probably wrong, or you can sum/average/... the rows, or have no total).

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan,

No we cant use patient as a dimension.

We have only Drug as a dimension.

sunny_talwar

I am not even sure what you are trying to get and that is why I recommend showing an example out of QlikView to explain what is that you are looking to get.

Not applicable
Author

Hi Sunny,

PFA attached sample qvw for median .

Let me know if there is a way to avoid AGGR.

sunny_talwar

Not sure if you don't have an inner aggregation in your real scenario, but this isn't even right... take a look at this

Capture.PNG

A is associated with two patients with two different NoOfDays.... and since the no of days don't match, the inner part of your expression is 0 for Drug A. Is this really what you want?

Not applicable
Author

All i want is to calculate median value for No of days spent at hospital for patients as per the drugs.


But patients should be inner aggregation . Patient is not a dimension in straight table.