Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Same Store analysis - Count and Sales

Hi All,

I have a data set on which I need to do Same Store analysis..

Same Store are the stores having sales last year and this year..

below is the sample data

YearStore IdSales
2013123100
2013124200
2013125300
2013126400
2013127500
2013128600
2013129700
2012123800
2012125900
20121271000
2012128200
2011124300
2011123500
2011129580
2011125900
20101231000

so based on the above data set I need same store analysis as below:

YearSame Store CountSame Store Sales
201341500
201221700
20111500
201000

The above output is based on the stores have sales to there previous year

for 2013 -- store count =4 (123,127,125,128) and similarly sales =1500 (100+300+500+600)

for 2012 -- store count =2 (123,125) and sales = 1700 (800+900)

how can I achieve this in a straight table..

Thanks in advance.

Aashish

1 Solution

Accepted Solutions
sushil353
Master II
Master II

Hi Sharma,

Try below code:

Temp:

load Year&Store as Key,

Year,

Store,

Sales

from source_file;

left join

Load (Year+1)&Store as Key,

1 as SSFlag

Resident Temp;

now in the expression you can simply use this flag to count and get the sales.

count({<SSFlag={1}>}Store)

sum({<SSFlag={1}>}Sales)

HTH

sushil

View solution in original post

13 Replies
ali_hijazi
Partner - Master II
Partner - Master II

sum(aggr(count({< Store={"=count(Store)>1"}Store),Year)) --------------------> same store count

sum(aggr(sum({<store={"=count(Store)>1"}Sales),Year)) ---------------------->same store sales

I can walk on water when it freezes
alkesh_sharma
Creator III
Creator III

IF I may ask, Your data says in Year 2010 there is a store 123 then Y don't count up in your output table.

Anonymous
Not applicable
Author

Hi Ali,

Your expression is not working.. it gives wrong result.. 😞

Anonymous
Not applicable
Author

HI Alkesh,

assuming that the store 123 don't have sales in year 2009...

ali_hijazi
Partner - Master II
Partner - Master II

isn't it what you want is to find number of stores that have more than one trx per year?

I can walk on water when it freezes
Anonymous
Not applicable
Author

Is this doable in QlikView ??

sujeetsingh
Master III
Master III

Straight table with Year as dimension

Count Distinct  and sum for slaes

jyothish8807
Master II
Master II

Hi Sharma,

I am not clear with your output table?

Can you explain a bit.

How you are getting 4 stores for 2013, then where store 124?

Regards

KC

Best Regards,
KC
rubenmarin

Hi Sharma, check attachment, I precalculate values on script.

I think there is typo in the 2nd 128 store for 2013, it is a typo or store 128 has 2 records in 2013?