6 Replies Latest reply: Apr 3, 2017 3:42 PM by Sunny Talwar

# Rank function with multiple dimensions

Hi experts,

I've made a bar chart with my top 10 invoices over the last 4 years.

Because Qlik doesn't have a function that shows the total sum of these top 10 customers per year, I wanted to use a KPI object to show the total sum of the top 10 invoices in a certain year.

See the following screenshot (Years are ordered as 2014-2017).

In the 4 different KPI objects I used the following function 4 times (Max Year, Max Year -1, -2, -3):

sum({1<Year={"\$(=max({<year>}Year))"},[Invoice Number] = {"=rank(sum([Nett Amount new EUR]),4,1) <= 10"}>} [Nett Amount new EUR] )

The numbers shown in the KPI objects are based on the top 10 invoices over the 4 years, instead of the top 10 invoices per year.

Could you guys help me out with this one or give me another solution?

Mike

• ###### Re: Rank function with multiple dimensions

May be this

Sum({1<Year={"\$(=Max({<year>} Year))"}, [Invoice Number] = {"=Rank(Sum({1<Year={\$(=Max({<year>} Year))}>} [Nett Amount new EUR]), 4, 1) <= 10"}>} [Nett Amount new EUR])

• ###### Re: Rank function with multiple dimensions

Thanks for your quick reply Sunny, but this function is showing a NULL value " - "..

• ###### Re: Rank function with multiple dimensions

I removed the double quotes within the Max({<year>}Year) thing... can you check... also do you have two year fields? Year and year? QlikView is case sensitive, make sure to use the correct casing everywhere

Sum({1<Year={"\$(=Max({<Year>} Year))"}, [Invoice Number] = {"=Rank(Sum({1<Year={\$(=Max({<Year>} Year))}>} [Nett Amount new EUR]), 4, 1) <= 10"}>} [Nett Amount new EUR])