Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rank with Set Analysis

Hi Guys,

I am trying to keep the ranking no matter what is selected. For example, I have three stores and their sales by product and year. I want to create a report for Store A that shows their ranking in comparison with the other stores by year and product. Below I have an example of my data and what I want. And so far what I can achieve. Note this is a simple example for my actual project I need to do a cross table.

Desired Result (Example):

StoreYearProductRanking
A2011D2
A2012D2
A2012E1

Here is my data:

StoreYearDEF
A2011238.1349314.8646191.1932
B2011642.1047776.4963335.7628
C201149.81719371.4189627.7992
A2012977.422823.2292213.7887
B2012738.0967946.879540.85955
C2012295.2093584.3845376.8542
A2013136.5952970.51701.4002
B2013635.2067744.0895227.2809
C2013850.517336.8081709.6592

Load Statement:

CrossTable(Product, Sales, 2)

LOAD Store,

     Year,

     D,

     E,

     F

FROM

QVTestData.xlsx

(ooxml, embedded labels, table is Sheet2);

What I have achieved so far, but if I select A the ranking changes to 1 for all.

Year201120112011201120112011201220122012201220122012201320132013201320132013
ProductDDEEFFDDEEFFDDEEFF
StoreSalesRankSalesRankSalesRankSalesRankSalesRankSalesRankSalesRankSalesRankSalesRank
A8871239181429260516641911154232972
B5252433142326932902650248291611063
C11531932653550128339639379524771

Rank Expression:

Rank( Sales)

1 Solution

Accepted Solutions
rustyfishbones
Master II
Master II

4 Replies
Nicole-Smith

Maybe:

Rank(total Sales)

or

Rank(sum({1}Sales))

rustyfishbones
Master II
Master II

Try this

2014-02-27_1814.png

Not applicable
Author

The latter works, but doesn't let me choose one Store. The rank always shows up, no matter my selections.

Not applicable
Author

This is perfect - I just needed to change D to Product, and add Product to the Aggr list: Aggr(Rank(Sum( {1} Sales)),Product,Year,Store).

Thank you!