Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
srinivasa1
Creator II
Creator II

sales diffrence calc for month and previous month

Hi,

i have a field year contains 2011,2012,2013 and month filter jan,feb,mar etc

i need to calculate the difference sales between current selected year  month and previous month.(ie)

if i selected year 2011 then  feb month then the result should find difference between jan and feb.....

pls,help me out thanks in advance.

30 Replies
autopilot
Creator III
Creator III

sum({$<Year={$(=max(Year))},Month={$(=month(addmonths(InvoiceDate,0)))}>}Sales)

-

sum({$<Year={$(=max(Year))},Month={$(=month(addmonths(InvoiceDate,-1)))}>}Sales)

srinivasa1
Creator II
Creator II
Author

Hi

Im looking for Sales diffrance eg if select year 2011 and month Jan and Feb.then sales diffrance will be Jan(sales)-Feb(sales)

Not applicable

So are you saying you'll always select exactly two months and that too consecutive months?

autopilot
Creator III
Creator III

sum({$<Year={$(=max(Year))},Month={$(=TextBetween(GetFieldSelections(Month),'',','))}>}Sales)

-

sum({$<Year={$(=max(Year))},Month={$(=TextBetween(GetFieldSelections(Month),',',''))}>}Sales)

will do exactly as you described

srinivasa1
Creator II
Creator II
Author

Sir,

It looks good but when i added my experssion part its not working.can pls upload sample app.

Thanks

srinivasa1
Creator II
Creator II
Author

No.Any range selected month or year.just like Select CY Month sales- CP Month sales

eg

sum (Feb(sales)-Jan(sales))  as diffrance between two month for selected Year

srinivasa1
Creator II
Creator II
Author

Thanks .my mistake missed some filed,If i select range of two month its  showing properly diffrance .but im looking it should do calculate if not selected also.

Eg

Year selected (if not selected year it should be shown for month on month diffrance for all the Year)

      2011

Jan-Feb dif  | Feb-Mar dif  so on in pivot table(ie Jan sales is 200- feb sales 100)

100               200 

2012

Jan-Feb dif  | Feb-Mar dif  so on in pivot table

500               200

2013

Jan-Feb dif  | Feb-Mar dif  so on in pivot table

60                       70

autopilot
Creator III
Creator III

see attached

srinivasa1
Creator II
Creator II
Author

i like the way you done it might usefull to me in future analysis.i wll upload some sample app by today evening so you understand well thanks for try.