Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

last 3months sales

Hi All,

How to get last 3 months sales dynamically of the respective year

If I take manually it works fine

Sum({<month={'Feb','Mar','Apr'},year={2016}>}sales)

It returns last 3months data of the current year(2016)

I tried with addmonths but didn't work.

Any ideas please suggest.

4 Replies
sunny_talwar

May be try this:

Sum({<Date = {"$(='>=' & Date(MonthStart(Max(Date), -3), 'DateFieldFormatHere') & '<=' & Date(MonthEnd(Max(Date), 0), 'DateFieldFormatHere'))"}, month, year>}sales)

Pulkit_Thukral
Partner - Creator II
Partner - Creator II

Sum({<Datefield={">=$(=date(floor(monthstart(addmonths(today()-3))),'DD-MM-YYYY'))"}*{'<$(=date(floor(monthstart(addmonths(today()-1))),'DD-MM-YYYY'))"} >}sales)

Anonymous
Not applicable
Author

LOAD * INLINE [

    LastMonth, Value

    01/01/2016, 10

    01/02/2016, 20

    01/03/2016, 30

    01/04/2016, 40

    01/05/2016, 50

];

=Sum({$<LastMonth={'$(=Date(Max(LastMonth)-3))'}>}Value)

HirisH_V7
Master
Master

Hi,

Check this

Sum({<Year=,Date={‘>=$(=MonthStart(Today(), -2))<=$(=Today())’}>} Sales )

HTH,

Hirish

HirisH
“Aspire to Inspire before we Expire!”