3 Formulas for Comparing Sales Data in Salesforce

Written by
Billy Weisgerber
Solutions Architect, Mountain Point

Comparing Sales Month over Month (MoM), Year over Year (YoY), and Year to Date (YTD) over the Previous Year to Date

Knowing exactly where your sales are at any given time can provide crucial insight into how you’re serving your customers and accomplishing your goals. But without context, that data can be hollow.

Fortunately, Salesforce can quickly pull past sales data to help your company stay on target and either capitalize on or mitigate seasonality in your KPIs.  But before you can delve into side-by-side comparisons of your current sales with those of previous months and years, you’ll need to run a few simple formulas.

Frequently, customers request ways to compare their Year Over Year (YoY) sales data, which can easily be managed with standard Salesforce reporting. But Month over Month (MoM) comparisons are not automatically built in.

Month over Month (MoM) Comparisons

Fortunately, with a formula checkbox field, we can easily pull MoM comparisons by creating a quick IF statement that checks for the Month of Today and if the record’s date also falls in that month. Once this is set, you can easily ensure your team is staying on target for your quarterly and annual goals.

(IF( MONTH(*Record Date*) = MONTH(Today()), True, False))

You can also edit the formula to instead show the previous two months by subtracting one on the comparison.

MONTH(*Record Date*) – 1

Once this formula is set, the records will update automatically without the need to continually adjust the filters on the individual fields of the reports. Below are two examples of data you can access with this formula and regular Salesforce reports.

YTD vs Previous YTD

Now that you can easily see an MoM snapshot, let’s take a wider lens and see how your sales are doing today versus this time last year. This approach can seem tricky because it requires a nested IF statement. But, with the right formula, you can get it to work. Using a formula checkbox field, insert the following formula, and you will be all set!

IF(AND((YEAR(*Record Date*) = (YEAR(TODAY()) - 1)), (*Record Date* <= (TODAY() - 365))), TRUE, IF((YEAR(*Record Date*) = YEAR(Today())),TRUE,FALSE))


What the formula looks for first is any Record that is from last year (YEAR(TODAY()) - 1) and is on or before the date last year (TODAY() - 365), and marks it True if the criteria are met. Next, it checks for any records that fall in the current year, to capture all current records, and marks it as true as well. Anything outside of those bounds will be excluded from the report. Once the field is set, create your report with the filter criteria in place, and you can have something similar to the image above. (YTD vs Previous YTD)

Now that you can quickly run sales data reports, check out other ways to make the most of your company data.

Get in touch today to start planning your next journey.

Describe your project and leave us your contact info, we’ll get back to you within 24 hours.
Budget estimation ( USD)
Add attachment
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.