Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Percentage comparison between months

Hi, please help me. I have this table and I need to compare amount of sales between months in percentage and then I need to make a chart from it. How can I do that?

PERIODSALES
201601256
201602263
201603486
201604156
201605848
201606564
201607452
201608489
201609856
201610485
201611523
201612875
1 Solution

Accepted Solutions

May be like this:

Sum(SALES)/Above(Sum(SALES)) - 1

Update: Missed a closing parenthesis which I have added not in red

View solution in original post

6 Replies
Specialist II
Specialist II

sum(SALES) / sum( Total SALES)

Not applicable

I´m sorry, I have not expressed myself clearly. I need to show the percentage growth between months. Can you help me?

May be like this:

Sum(SALES)/Above(Sum(SALES)) - 1

Update: Missed a closing parenthesis which I have added not in red

View solution in original post

Creator III
Creator III

Sum(SALES)/Above(Sum(SALES)

Partner
Partner

Hi,

You can create a calendar like :

LOAD Date#(PERIOD, 'YYYYMM') as _PERIOD, SALES INLINE [

    PERIOD, SALES

    201601, 256

    201602, 263

    201603, 486

    201604, 156

    201605, 848

    201606, 564

    201607, 452

    201608, 489

    201609, 856

    201610, 485

    201611, 523

    201612, 875

];

SET vMinDate = 201601;

SET vMaxDate = 201612;

CAL:

LOAD

  Date#($(vMinDate)+RecNo()-1, 'YYYYMM') as _PERIOD,

  Date#($(vMinDate)+RecNo()-1, 'YYYYMM') as PERIOD,

  'M' as TYPE

AutoGenerate ($(vMaxDate)-$(vMinDate)+1)

;

Concatenate(CAL)

LOAD

  Date(AddMonths(Date#(_PERIOD, 'YYYYMM'), -1), 'YYYYMM') as _PERIOD,

  PERIOD,

  'M1' as TYPE

Resident CAL

;

And this expression :

Sum({<TYPE={'M'}>}SALES)

/ Sum({<TYPE={'M1'}>} SALES)

Not applicable

Thank you very much, it works!