Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
anat
Contributor

Top 5 records group by 2 dims in stright table and bar chart

Hi , below is my source data:

 

YearLocSales
2015a100
2015b250
2015c50
2016a250
2016b200
2016c350
2016d10
2017a300
2017b100
2017c400

need to display output stright table:

 

YearLocSales
2017c400
2017a300
2016c350
2016a250
2015b

250

same output in bar chart also please find the attachment required format.

Requirement is :Year & Loc are dimensions and expressions is :sum(Sales)

i have to display top 5 Loc records based on sum(Sales) and then order by Year

i have tried all the possible ways like order by sum(sales) desc and dimension limit but no luck.

8 Replies

Re: Top 5 records group by 2 dims in stright table and bar chart

Try this expression.

Sum ({<Sales = {'=Rank(Sum(Sales),0,4)<=5'}>}Sales)

Regards,

Kaushik Solanki

shiveshsingh
Honored Contributor

Re: Top 5 records group by 2 dims in stright table and bar chart

Hi Kaushal

Can you please explain this set expression?

kakani87
Valued Contributor

Re: Top 5 records group by 2 dims in stright table and bar chart

Top5.png

kakani87
Valued Contributor

Re: Top 5 records group by 2 dims in stright table and bar chart

Check this as Koushik suggested

Re: Top 5 records group by 2 dims in stright table and bar chart

Hi,

It says that give the sum of Sales where the rank of the sales if below 5.

Regards,

Kaushik Solanki

shiveshsingh
Honored Contributor

Re: Top 5 records group by 2 dims in stright table and bar chart

Rank(0,4) what this means?

I am bit confused in rank function

kakani87
Valued Contributor

Re: Top 5 records group by 2 dims in stright table and bar chart

Hi Kaushik ... as Shivesh asked what this Rank(0,4) indicates

Because the below expression as well giving the same output with out 0,4

Sum ({<Sales = {'=Rank(Sum(Sales))<=5'}>}Sales)

anat
Contributor

Re: Top 5 records group by 2 dims in stright table and bar chart

hi Kaushik, thanks for support,for single expression its working fine,suppose if i use 2 expressions then i am not getting proper output.can u please check by adding dummy expression in chart level.PFA....