Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qliktech_uk
Contributor III
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.

7 Replies
Anil_Babu_Samineni

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)



Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
mostwanted123
Creator
Creator

Try this,

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


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


Regards,

Pratik

qliktech_uk
Contributor III
Contributor III
Author

Thanks for your reply. Shouldnt the months be ordered?

Anil_Babu_Samineni

Means

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
qliktech_uk
Contributor III
Contributor III
Author

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?

Anil_Babu_Samineni

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

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
qliktech_uk
Contributor III
Contributor III
Author

thanks Anil. Testing it, will let you know.