Please help with my expression.
I am trying to get a sum of previous year to date sales.
if(date([INVC DATE])=yeartodate([INVC DATE],-1),SUM([TOT AMT]), 0)
Once i get this right I will make it a flag in my Load but for now I am testing it as an expression
Any help is much appreciated
I believe you dont need to make a comparison, just use:
if(yeartodate([INVC DATE],-1),SUM([TOT AMT]), 0)
do you want to try this:
if(year2date([INVC DATE], -1), sum(TOT AMT), 0)
Neither suggestions worked. Both outputted 0 but I have data ranging four years.
I believe you just need to switch the if() to inside the sum():
sum(if(yeartodate([INVC DATE],-1),[TOT AMT]))
Works with this, thanks John!
Retrieving data ...