Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
May be try this:
Sum({<Date = {"$(='>=' & Date(MonthStart(Max(Date), -3), 'DateFieldFormatHere') & '<=' & Date(MonthEnd(Max(Date), 0), 'DateFieldFormatHere'))"}, month, year>}sales)
Sum({<Datefield={">=$(=date(floor(monthstart(addmonths(today()-3))),'DD-MM-YYYY'))"}*{'<$(=date(floor(monthstart(addmonths(today()-1))),'DD-MM-YYYY'))"} >}sales)
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)
Hi,
Check this
Sum({<Year=,Date={‘>=$(=MonthStart(Today(), -2))<=$(=Today())’}>} Sales )
HTH,
Hirish