Einstein Analytics Tips & Tricks: Comparing Sales YTD vs Sales PYTD

This post originally appeared on the Atrium blog. Authored by Doug Weinheimer.

I recently came across a use case in Einstein Analytics which I’m sure many people have run into in the past. How do we handle yearly “to date” comparisons?

Say we want to analyze our sales YTD. That is pretty easy, we just use the “Year to date” filter on our date field.

But what if we wanted to compare to last year during the same time frame? There is no “Last Year to this day last year” filter available.

Sure, this can be done with SAQL fairly easily by doing something like:
date in [\”1 years ago\”..\”current day — 1 year\”]


But, what if we don’t want to convert our whole lens into an SAQL step just for this one comparison? The answer is actually fairly simple, just use the “Previous year to date” filter and we can adjust it in the dashboard JSON.

Once we’ve gotten the data we need into the chart and added it to our dashboard, open up the dashboard JSON (CTRL+E or CMD+E) and find our step. We will see the filter section for our PYTD column which looks like this:


This is basically a full years worth of data plus the current year to today. If we want to look at the previous year to the same day in the previous year we just need to change “day”,0 to “day”,-365 and that will give us the same time period for the previous year.


Now we can compare our sales YTD vs our sales PYTD!

As the market leader in intelligent solutions, we help organizations make smarter decisions and act on them. Learn more at atrium.ai

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store