Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i have to do a comparison between sales of a date vs sales of last year for the same date and same weekday.
For example, I have two expressions:
Sales
SalesLastYear
If I select 10 november (Thursday) then:
How I can calculate SalesLastYear?
Perhaps like this:
Selected date: sum(Sales)
Last Year: sum({<MyDateField={"$(=Date(Max(MyDateField)-364,'DD MMM YYYY'))"}>}Sales)
I think it might also make sense to look at The As-Of Table since you are doing a weekday wise comparison here.
Its funny how you proposed As-Of-Table in another post and I proposed another alternative and now you proposed another alternative and I ended up proposing the AsOfTable approach
= if((Mod(Max(Year),4)=0 and Mod(Max(Year),100)<>0) or Mod(max(Year),400)=0,
Sum( {<Date={"$(=(Date((Max(Date)-365),'DD/MM/YYYY')))"},Year=,Month=>} [Sales] ),
Sum( {<Date={"$(=(Date((Max(Date)-364),'DD/MM/YYYY')))"},Year=,Month=>} [Sales]))
This expression will ensure that Leap Year is not missed 🙂
@sunny_talwar / @Gysbert_Wassenaar ,
Do you have a sample application of this approach , I would like to go through it for a better understanding
Did you look at the link shared above (The As-Of Table)? It does give sample code?