Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a line graph showing the last 8 weeks of revenue, using the dimension =date(aggr(if(Rank([Week])<=8,[Week]),[Week]),'D MMM')
How can I show the same last 8 weeks but from last year on a line chart?
Found a way to get this by using addyears():
dimension:
date([Week],'D MMM')
OR more accurate: Fiscal Week Number
expression (for this year last 8 weeks) -
sum({<Date={'>=$(=WeekStart(Max(Date), -7))<=$(=Date(Max(Date)))'}>} Revenue)
expression (for last year last 8 weeks) -
sum({<Date={'>=$(=WeekStart(addyears(Max(Date),-1), -7))<=$(=Date(addyears(Max(Date),-1)))'}>} Revenue)
Let VLastyear=max(YearField)-1
Take this as Dim =date(aggr(if(Rank([Week])<=8,[Week]),[Week]),'D MMM')
Expression: =sum({<YearField={'=$(=VLastyear'}>} sales)
please check
Hi, that doesn't seem to work. It returns the same revenue as sum(Revenue).
Found a way to get this by using addyears():
dimension:
date([Week],'D MMM')
OR more accurate: Fiscal Week Number
expression (for this year last 8 weeks) -
sum({<Date={'>=$(=WeekStart(Max(Date), -7))<=$(=Date(Max(Date)))'}>} Revenue)
expression (for last year last 8 weeks) -
sum({<Date={'>=$(=WeekStart(addyears(Max(Date),-1), -7))<=$(=Date(addyears(Max(Date),-1)))'}>} Revenue)