Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
anriretief
Contributor III
Contributor III

Median of top 5 values

Hi all

I have two dimensions (Seisoen and Maand)

I want to calculate the median of the top five values 

I used the following expression but it doesn't seem to give the overall median for the top 5 values

if(

num(left(rank(aggr(sum(if([Seisoen Kort]>=vSeisoenBrake,[MM Daaglikse Syfers],
if([Seisoen Kort]<vSeisoenBrake,[MM Maand Syfers]))),Seisoen,Maand)),1),'0') <=5
and
(mid(rank(aggr(sum(if([Seisoen Kort]>=vSeisoenBrake,[MM Daaglikse Syfers],
if([Seisoen Kort]<vSeisoenBrake,[MM Maand Syfers]))),Seisoen,Maand)),2,1)='-'
or
trim(mid(rank(aggr(sum(if([Seisoen Kort]>=vSeisoenBrake,[MM Daaglikse Syfers],
if([Seisoen Kort]<vSeisoenBrake,[MM Maand Syfers]))),Seisoen,Maand)),2,1))=''), 


median(aggr(sum(if([Seisoen Kort]>=vSeisoenBrake,[MM Daaglikse Syfers],
if([Seisoen Kort]<vSeisoenBrake,[MM Maand Syfers]))),Seisoen,Maand))
)

Any help would be greatly appreciated 

 

Regards

Anri

11 Replies
anriretief
Contributor III
Contributor III
Author

Okay, thank you for the help!
uacg0009
Partner - Specialist
Partner - Specialist

Hi Anriretief,
How is the result, if it works, could you please mark as solved, it's also good for other guys.
Thanks.
Aiolos