2 Replies Latest reply on Feb 17, 2017 3:51 PM by Jamieson Christian

# YTD vs YAG YTD and versus 2 YAG full year

to compare YTD vs YAG, I'm using:

if [Date] <= TODAY() and [Date] <= DATEADD('year',-1,today())

then ([Records])

END

how should I adjust the calculation?

?

thank you.

• ###### 1. Re: YTD vs YAG YTD and versus 2 YAG full year

H Mark,How do you define YAG and 2 YAG "full" year.?

• ###### 2. Re: YTD vs YAG YTD and versus 2 YAG full year

Mark,

I assume "YAG" is short for "Years Ago"?

The formula you presented doesn't really make sense to me. It looks like you're checking to see if the date is earlier than today and is earlier than this day a year ago. Well, the latter implies the former, so your formula amounts to:

```IF [Date] <= DATEADD('year',-1,TODAY())
THEN [Records]
END
```

If you're trying to do some sort of year-over-year comparison, that won't really get what you need.

Here are some useful functions to isolate segments of your data:

Year-to-date Current Year

```IF [Date] <= TODAY() AND DATEDIFF('year',[Date],TODAY()) = 0
THEN [Records]
END
```

Year-to-date Prior Year

```IF [Date] <= DATEADD('year',-1,TODAY()) AND DATEDIFF('year',[Date],TODAY()) = 1
THEN [Records]
END
```

2 Years Ago Full Year

```IF DATEDIFF('year',[Date],TODAY()) = 2
THEN [Records]
END
```

Hope this helps.