Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating last 6 months based on selected month

Hello All,

I would like to know if it is possible to automatically calculate last 6 months based on my selected month:

For example if i choose Jan 2016

How can I get make my graph automatically to show:

janv-2016

Dec-2015

Nov-2015

Oct-2015

Sept-2015

Aug-2015

Any idea?

Many Thanks,

Hasvine

23 Replies
jagan
Luminary Alumni
Luminary Alumni

YOu can also check for various similar expressions from below link

Set Analysis for Rolling Periods

Regards,

Jagan.

Not applicable
Author

The problem is that if i choose the month 10 for example it gives me the months 5 to 12.

It does not stop at the month 10. 😞

ecolomer
Master II
Master II

See this example:

Not applicable
Author

It doesnt help in my situation unfortunately.

Thanks,

Hasvine

ecolomer
Master II
Master II

Is this you need?

p_roll.png

jonathandienst
Partner - Champion III
Partner - Champion III

I would load like this to correctly handle data that spans over more than one year:

SalesData:

LOAD

  Date(MakeDate(Year, Month), 'MM-YYYY') as Month,

  Year*12 + Month as MonthSequence,

  Year,

  Amount

inline [

Year, Month, Amount

2015,8,7

2015,9,8

2015,10,6

2015,11,9

2015,12,7

2016,1,6

2016,2,4

2016,3,7

2016,4,3

2016,5,4

2016,6,9

2016,7,5

2016,8,7

2016,9,8

2016,10,6

2016,11,9

2016,12,7

];

And use the expression:

Sum({<MonthSequence = {">$(=Max(MonthSequence)-6)<=$(=Max(MonthSequence))"}, Month, Year>} Amount)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
ecolomer
Master II
Master II

Sorry, if you need 6 month, change in the formula 5 for 6

Not applicable
Author

I need the first table.

Can you please explain how you did it.

Many Thanks,

Hasvine

ecolomer
Master II
Master II

OK,

in dimension are Month and in the expression put this:

Sum({<Month={'>=$(=Max(Month)-6)<$(=Max(Month))'}>}Amount)

tresesco
MVP
MVP

check the updated expression :


Sum({<Month={'>=$(=Max(Month)-5)<$(=Max(Month))'}>}Amount)