Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikuser22
Creator II
Creator II

Calculate middle value and peek the other values

Hi

I am trying to find median and for the calculated median value, need to extract values for the same row and use it as KPI.

For example: 

I want to calculate the median for d like median(d) which is 5.(Highlighted row). Now I must extract 1, 7 , 6 and store it as a KPI. I am able to find median for each column. But I need to calculate median for only one column and peek the values for the calculated median with its corresponding values from other columns. 

I am not sure if its fairy simple or difficult. 

 

Thanks in advance. 

qlikuser22_1-1645795217295.png

 

 

Labels (5)
4 Replies
hic
Former Employee
Former Employee

Not easy. You want to use an aggregation (Median) to extract an unaggregated number (a value in raw data). These two operate on different domains, and this complicates things. 

Further, your definition is ambiguous. There are three rows where d=5. Which one do you want to use?

Henric_Cronstrm_0-1645806195655.png

 

qlikuser22
Creator II
Creator II
Author

Hi thanks for the reply.

I have to calculate the median. If there are 10 rows, then 5th row will be the median value and pick the corresponding data from other columns. That's what I am looking for irrespective of 3 rows with  value=5. 

 

thanks

qlikuser22
Creator II
Creator II
Author

HI @hic 

I am still struck with this logic. Is it possible to sort the column and find the middle value and then copy the corresponding values from the other columns.

Example: Sort the numbers in column A , assume, the no of rows in column A is 50, then middle row number is 25. For that row, just pick the values for a,b,c,d. 

 

Any help.

 

Thanks in advance.

 

hic
Former Employee
Former Employee

First, you need to have a Row ID, e.g. 

Load RowNo() as RowNo, a,b,c,d ...

Then you can use an Aggr() to pick out relevant values. For example, the following will pick out the values of c in the rows where d = Median(d) 

=Concat(Aggr(If(Median(total d)=Only(d),c),RowNo),',')