It sounds like your trying to do a what if scenario?
You could do something like
if datetrunc('year',[date])=datetrunc('year',today()) then [sales]*1.2 else [sales] end
This would increase all of this year's sales by 20%
Ok, I'm still a little confused by the datetrunc formula... I don't need today's sales, but rather sales in 2008. So would I do
if datetrunc('year',[date])=2008 then [sales]*1.2 else [sales] end ??
Or is there a different formula I need to incorporate here instead of just putting 2008? Thanks
you could do datetrunc('year',[date])=#1/1/2008# or datepart('year',[date])=2008
so I tried this formula:
If DATEPART('year',[Date])=2008 THEN ([Total Sales])*1.2 ELSE ([Total Sales]) END
Only to get the "cannot mix aggregate and non-aggregate comparisons or results in an 'If' expression"
I do not understand this error, as the two "total sales" parts are the same. Any thoughts?
Now you are trying to compare a row level (date =2008) with what presumably is an aggregation - think column total (does [total sales equal sum([sales])??
If you have the non-aggregated sales, use this.