Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last 13 Months Sales

Hi all,

I need to show last 13 months sales in bar chart when a date is selected, but


1. when the selected date is month end of the selected date like(3/31/2017) i need to show current month and           last 12 months (From Feb 16 to including Mar 17)

2. when the selected date is weekend of the selected month like (4/30/2017) i need to show current month and         last 12 months also (From Mar 16 to Apr/28/2017)


I know how to show last 13 months sales using Monthstart and Addmonths functions, but i need help for these two conditions


Thanks in advance.

1 Solution

Accepted Solutions
Anil_Babu_Samineni

May be this? I am sure, this should work

=If(GetFieldSelections(DateField) = '$(=MonthEnd(GetFieldSelections(DateField)))', Sum({<DateField = {">=$(=AddMonths(Max(DateField),-13)) <=$(=Max(DateField))"}>}Sales), Sum({<DateField = {">=$(=AddMonths(Max(DateField),-13)) <$(=Max(DateField))"}>}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

View solution in original post

4 Replies
Anil_Babu_Samineni

Here, If you select 14-Apr-2017 Then what you are expecting for Role Month? Does this you need Mar 16 - Apr 17??

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
Not applicable
Author

Hi Anil

If i select 14-Apr-17, then chart needs to show from 01-Mar-2016 to 31-Mar-17( last 13 months).

Need help on this..

Thanks

Anil_Babu_Samineni

May be this? I am sure, this should work

=If(GetFieldSelections(DateField) = '$(=MonthEnd(GetFieldSelections(DateField)))', Sum({<DateField = {">=$(=AddMonths(Max(DateField),-13)) <=$(=Max(DateField))"}>}Sales), Sum({<DateField = {">=$(=AddMonths(Max(DateField),-13)) <$(=Max(DateField))"}>}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
Not applicable
Author

Hi Anil,

its working in one scenaio, iam building on that one.

Thanks for your help.