# Qlik Sense App Development

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

Tags (3)
21 Replies
MVP

## Re: Median without AGGR: Performance Issues

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

## Re: Median without AGGR: Performance Issues

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

MVP

## Re: Median without AGGR: Performance Issues

Do you have a sample you can share?

MVP

## Re: Median without AGGR: Performance Issues

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).

Not applicable

## Re: Median without AGGR: Performance Issues

Hi Jonathan,

No we cant use patient as a dimension.

We have only Drug as a dimension.

MVP

## Re: Median without AGGR: Performance Issues

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

## Re: Median without AGGR: Performance Issues

Hi Sunny,

PFA attached sample qvw for median .

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

MVP

## Re: Median without AGGR: Performance Issues

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

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

## Re: Median without AGGR: Performance Issues

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.