Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Team,
I trying to get Last Year month sales after selecting Current Year months.
If select currenct MonthYear Jun-2019,Jul-2019,Aug-2019 then i need sales for previous Year same months Jun-2018,Jul-2018,Aug-2018 sales.
I tried with below expressions but not working. Please help on this.
Sum({<Year=,MonthYear=,
KeyDate={">$(=YearStart(Max(KeyDate),-1))=$(=AddYears(Max(KeyDate),-1))"}>} Sales)
Sum({$<Year=,KeyDate={">=$(=YearStart(Max(KeyDate),0))<=$(=AddYears(Max(KeyDate),0))"}>} Sales)
Sum({<YearMonth ={">=$(=Date(addmonths(Max(YearMonth), -12), 'MMM-YY'))<=$(=Date(addmonths(Max(YearMonth), -1), 'MMM-YY'))"}>}
Sales)
May be this
Sum({<MonthYear = {">=$(=Date(AddYears(Min(KeyDate), -1), 'MMM-YYYY'))<=$(=Date(AddYears(Max(KeyDate), -1), 'MMM-YYYY'))"}, Year, KeyDate>} Sales)
Do you have YearMonth and MonthYear fields? Which field are you making a selection in? YearMonth or MonthYear? Also, do you need to go back to YearStart or just the same months for last year?
Hi sunny,
Yes, I do have MonthYear Jan-2019 ....like this.
I am making selection in MonthYear only.
I need to go for just last year same month.
If i selected Jan-2019, Feb-2019,Mar-2019 then i need to see last Year sales for Jan,Feb,Mar 2018.
May be this
Sum({<MonthYear = {">=$(=Date(AddYears(Min(KeyDate), -1), 'MMM-YYYY'))<=$(=Date(AddYears(Max(KeyDate), -1), 'MMM-YYYY'))"}, Year, KeyDate>} Sales)
Yes Sunny. Thanks a lot. Working perfect