Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
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))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

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??

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
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))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

Not applicable
Author

Hi Anil,

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

Thanks for your help.