Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
qliktech_uk
New Contributor III

Last 12 months

Hi,

I have extracted the data for the last 12 months and now need to do month on month analysis.

If a user selects lets say May 2017, I need to show the data for May and difference from April, ie May - April.

So do I use GetFieldSelections and then use Addmonths(month, -1)?

In another table I need to show a trend as well, so to sort the data from last month to the current month, how would I sort it?

thanks.

Tags (1)
7 Replies

Re: Last 12 months

May be this?

For May 

Sum({<MonthName = {'$(=Max(MonthName))'}>} Sales)

For May - April

Sum({<MonthName = {'$(=Max(MonthName))'}>} Sales) -

Sum({<MonthName = {'$(=AddMonths(Max(MonthName),-1))'}>} Sales)



Life is so rich, and we need to respect to the life !!!
mostwanted123
Contributor

Re: Last 12 months

Try this,

Sum({<MonthName = {"$(=Max(MonthName))"}>} Sales) -


Sum({<MonthName  = {"$(=AddMonths(Max(MonthName),-1))}>} Sales)


Regards,

Pratik

qliktech_uk
New Contributor III

Re: Last 12 months

Thanks for your reply. Shouldnt the months be ordered?

Re: Last 12 months

Means

Life is so rich, and we need to respect to the life !!!
qliktech_uk
New Contributor III

Re: Last 12 months

If I have months from May 17 to Apr 16, I cant use the month numbers as then december would be 12 and I will get the max as December. How would I manage the order of the months

5,4,3,2,1,12,11,10,9,8,7,6

Would I have to create an inline table to define this order. If so wouldnt I have to manually change it for each month?

Re: Last 12 months

If you use MonthNum / MonthName as Dimension and expression where i gave you can use and check..

Life is so rich, and we need to respect to the life !!!
qliktech_uk
New Contributor III

Re: Last 12 months

thanks Anil. Testing it, will let you know.

Community Browser