Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Chart Sort Question

I would like to sort based on the current month's sales figures in descending order. I have both current and previous month's data.

Let' say I have the following data -


Table:
LOAD * INLINE [
Customer, Month, Item, Sales
Kobe Bryant, 2010/5, Basketball, 25
Kobe Bryant, 2010/5, Cap, 75
Kobe Bryant, 2010/6, Shirt, 100
Kobe Bryant, 2010/6, Basketball Shoes, 200
Paul Pierce, 2010/5, Towel, 50
Paul Pierce, 2010/5, Shorts, 200
Paul Pierce, 2010/6, Basketall, 25
Paul Pierce, 2010/6, Cap, 50
Ray Allen, 2010/5 , Basketball, 25
Ray Allen, 2010/5 , Golf Balls, 25
Ray Allen, 2010/6 , Towel, 50
Ray Allen, 2010/6 , Shirt, 100
Pau Gasol, 2010/5 , Shirt, 100
Pau Gasol, 2010/5 , Basketball, 250
Pau Gasol, 2010/6 , Pants, 25
Pau Gasol, 2010/6 , Shirt, 25
]
;



The sort should be based on the current month's sales data in descending order followed by it's previous month's data.

Desired results below -



Customer Month Sales CurrMonthSales Rank
-----------+-------+------+---------------+----+
Kobe Bryant 2010/6 300 300 1
Kobe Bryant 2010/5 100 300 1
Ray Allen 2010/6 150 150 2
Ray Allen 2010/5 50 150 2
Paul Pierce 2010/6 75 75 3
Paul Pierce 2010/5 250 75 3
Pau Gasol 2010/6 50 50 4
Pau Gasol 2010/5 350 50 4


Tried using set analysis to get the current month sales and refer to that value per month but can't get the previous month row to line up with the current month's data ie. for Kobe Bryant, I can display CurrMonthSales = 300 for 2010/6 but not 2010/5. I would like to use this expression to create my sort order via ranking. I have attached a sample QVW and the expected result.

Thanks.



2 Replies
Not applicable
Author

Tried using set analysis to get the current month sales and refer to that value per month but can't get the previous month row to line up with the current month's data ie. for Kobe Bryant, I can display CurrMonthSales = 300 for 2010/6 but not 2010/5. I would like to use this expression to create my sort order via ranking. I have attached a sample QVW and the expected result.

pover
Luminary Alumni
Luminary Alumni

Anthony,

I almost got you your expected result. Let's see if somebody can work out the rank column or if I come up with something later. The set analysis I did should be replaced with something dynamic and you can use an if instead of set analysis, too.

Regards.