Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
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