Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
anat
Master
Master

top 5 records in bar chart(2dims and 2 expressions)

hi , source data:

    

YearLocSalesTarget
2015a100200
2015b250150
2015c50100
2016a250200
2016b20020
2016c350200
2016d105
2017a300200
2017b100300
2017c400200

need output like below(need to display output in stright table and bar chart):

    

YearLocSalesTarget
2017c400200
2017a300200
2016c350200
2016a250200
2015b250150

Requirement: top 5 records based on sum(Sales) and year descending order.

dimensions: Year,Loc

Expression : sum(sales),sum(target)

8 Replies
mdmukramali
Specialist III
Specialist III

Hi,

LOAD * Inline

[

Year,Loc,Sales,Target

2015,a,100,200

2015,b,250,150

2015,c,50,100

2016,a,250,200

2016,b,200,20

2016,c,350,200

2016,d,10,5

2017,a,300,200

2017,b,100,300

2017,c,400,200

]

;

Dimension: Year, Loc

Expression :


for Sales =Sum({<Sales={"= Rank(Sum(Sales))<5"}>} Sales)


for Target = =Sum({<Sales={"= Rank(Sum(Sales))<5"}>} Target)


Output:


291823.PNG



Thanks,

Mukram.

anat
Master
Master
Author

Thanks for response, same is working in table but not in chart,can you please check .

swuehl
MVP
MVP

Instead of two dimensions in your bar chart, use one calculated dimension

= Year & ' - ' & Loc

anat
Master
Master
Author

As per requirement,I have to use 2 separate dims.

anat
Master
Master
Author

Hi Team, any other possibilities?

anat
Master
Master
Author

Hi Stefen, any other possibilities ?

anat
Master
Master
Author

Hi Ali,any other possibilities by using 2 separate dims?

sranjaspreet
Partner - Contributor
Partner - Contributor

Hi All,

I have similar situation with two dimensions in a stacked bar chart.

Requirement is to calculate the top 10 sales for products for each year.

Can anybody help.

Thanks in advance.