Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

how to calculate last 6 months and next 6 months sales based on my selection?

Hi,

I have simple requirement if i select any month i want display last 6 month sales.

Ex:if i select march i want dislpay last 6 month sales like  oct,nov,dec,jan,feb and mar.sales i want show. how to write the set expression.

same way if i select any month i want display next 6 month sales.

Ex: If i select June than display june,july ----up to Nov.

Thanks

chaitu

3 Replies
Highlighted

Re: how to calculate last 6 months and next 6 months sales based on my selection?

May be this

Last 6 months

Sum({<Date = {"$(='>=' & Date(MonthStart(Max(Date), -6), 'DateFieldFormatHere') & '<=' & Date(Max(Date), 'DateFieldFormatHere'))"}, Month, Year, MonthYear>}Sales)


Next 6 months

Sum({<Date = {"$(='>=' & Date(Max(Date), 'DateFieldFormatHere') & '<=' & Date(MonthStart(Max(Date), 7) - 1, 'DateFieldFormatHere'))"}, Month, Year, MonthYear>}Sales)

Highlighted
Partner
Partner

Re: how to calculate last 6 months and next 6 months sales based on my selection?

Hi

Try this 

=Sum({<Date={">=$(=MonthStart(Max(Date),-5))<=$(=MonthEnd(Max(Date),+6))"}>} Sales )Capture5.PNG

Highlighted
Partner
Partner

Re: how to calculate last 6 months and next 6 months sales based on my selection?

Hi,

Please see attached QVW. !