đź“Ł Attention Salesforce Certified Trailblazers! Link your Trailhead and Webassessor accounts and maintain your credentials by December 14th. Learn more.

Analyze Your Data Over Time

Learning Objectives

After completing this unit, you’ll be able to:
  • Manage date grouping, filtering, and visualization.
  • Apply filters correctly by understanding the data.

The Exploration Goal

You’re still enjoying getting to know Analytics and how it can help DTC. Based on your previous data exploration using Analytics, you’re thinking of a bonus contest for laptops as a sales incentive. You’re interested to see how your product sales have trended over time. The data is there, and you want to use Analytics to walk through it and ask questions. We'll show you how.

Here’s your goal for this unit: You want to see how your sales have evolved through time for the past few months. You also want to focus on laptops and see how the next few months look to validate the need for a bonus contest. So let’s see what the data tells us.

Group by Date

You want to see how laptop sales evolve over time, so you’ll open and explore the DTC Opportunity dataset, which contains opportunity and product information.
In the default exploration state, as you remember from the previous unit, the query is aggregating on count of rows with no grouping and no filtering. Start a new exploration by going back to the My DTC Sales app and opening the DTC Opportunity dataset. You’re interested in the number of laptops involved, so complete the following steps.
  1. Click Count of Rows under Bar Length to change the measure.
  2. Select Sum in the aggregation functions list.
  3. Select # (number sign) for the measure to see the number of products in your closed opportunities.
Next you’ll group the opportunities closed by month. Grouping by date works a little differently than grouping by regular dimensions.
  1. Click the plus sign (+) under Bars.

    You’ll see the Date dimensions at the top of the list.

  2. Click Close Date.
  3. Select Year-Month from the picklist.

The Date picklist lets you group by Year, Quarter, Year-Quarter, and so on. Selecting Quarter groups all quarters together across all years. Grouping by Year-Quarter groups first by year and then by quarter for each year. Year-Month groups first by year, then by month.



If the calendar and fiscal year differ, you can enable Analytics to generate the fiscal date fields in the dataset in addition to calendar date fields. You can customize the data pipeline to match your company’s fiscal calendar. Learn more from Date Handling in Datasets in the Salesforce Help.

Relative and Absolute Filters on Date

The closed date values go up to last year, but we’re only interested in the last three months and three months ahead from today—for the purposes of our example, April 1, 2016.
There are two ways to filter on dates.
  • Relative to now, which allows you to set dynamic filters based on the actual time. You can go from relative years to relative days. It’s a powerful way to get the most up-to-date metrics.
  • Absolute date range, which is a fixed date filter. We’re going to go with that.
Add a filter for the closed date to show opportunities that closed three months ago to three months ahead. Assuming today is April 1, 2016, we’ll look for opportunities from the beginning of January until the end of June.
  1. Click the plus sign (+) under Filters.
  2. Select Close Date in the Dates category.
  3. Select Custom.
  4. Click the Absolute date range tab.
  5. Select Between.
  6. In the From field, click the calendar symbol, find January 1, 2016, and select it. You can also just type 1/1/2016 in the field.
  7. In the To field, do the same thing and select June 30, 2016.
    Filtering on a six month absolute range
  8. Click Add.

Choose the Right Visualization for Dates

The bar chart is a great tool for comparison, but it’s difficult to show evolution through time. The timeline is helpful when you’re grouping by date.
  1. Click Chart button to open the chart gallery.
  2. Select the Timeline chart.
The Timeline chart shows the total number of opportunities over time


If you hover over Timeline in the chart gallery, the pop-up text provides the requirements for timeline charts.

You’re looking at the evolution of opportunities through time. It might be interesting to see how many opportunities you’ve lost or won. The good news is that you can have another grouping on the timeline.
  1. Click the plus sign (+) under Lines.
  2. Select Won.
    The lens shows that your won opportunities have dropped over the past quarter

It looks like opportunities might be heading for a fall in the next couple months. Let’s take a closer look to make sure what we’re seeing is accurate before we form any conclusions.

Understand Your Data

Upon closer inspection, you see something weird in the chart. You’re seeing opportunities closing after this month (remember, for the purposes of our example, we’re agreeing that today is April 1, 2016). Indeed, Close Date can be in the future, in which case it’s the expected close date. This means you’re seeing all opportunities that have a close date, rather than those that are already closed. We need to refine the query a bit more.
First, let’s explain how closed opportunities are represented in Salesforce. Closed opportunities can be expressed through two dimensions.
  • Opportunity Closed—is true when closed or false when open.
  • Stage—is Closed Lost or Closed Won when the opportunity is closed.
So let’s use the contains filter to filter by all the stage names that contain closed.
  1. Click the plus sign (+) under Filters.
  2. Select the Stage dimension. You can find it fast by typing Stage in the search field.
  3. Click Equals to open a drop-down list.
  4. Select Contains.

    An input field appears, which will be the search value powering the contains filter.

  5. Type Closed.
  6. Click Add.

VoilĂ , you have included multiple values with one filter. This kind of filter can be powerful in many situations, so keep it in mind.

Focus Your Lens

Now let’s dig in deeper and examine your laptop numbers more closely.
  1. Click the plus sign (+) under Filters.
  2. Select the Product Name dimension.
  3. Click Equals to open a drop-down list and select Contains.
  4. Type laptop.
  5. Click Add.

The new filter shows a sharp increase and then decrease in won laptop opportunities

After applying the filters, you see that laptop sales have been increasing, but are in for a significant downturn. It’s definitely a good time to start the contest to grow laptop sales!

Save Your Exploration in a Lens

You were interested in how your laptop sales have been trending over time, and you realized thanks to Analytics that they may be in for a fall! You definitely need to start your laptop sales contest as soon as possible. Save your exploration in a lens so you can share your discovery with coworkers.
  1. Click Save Button.
  2. Enter D02 - Laptops Opportunities Evolution / Time as the title.
  3. Select My Exploration.
  4. Click Save.

Continuing Your Explorations

To sum up, you’ve learned how to accomplish the following tasks.
  • Group by date, which is usually done by at least two attributes: Year-Quarter, Year-Month, Year-Week, or Year-Month-Day.
  • Filter by date, whether absolute or relative to the time when you’re asking the question.
  • Display date grouping properly through a timeline visualization and add a second grouping to it.
  • Filter a dimension using the contains filter.
  • Narrow the focus of your lens to selected fields in a dimension.

In the next unit, you’ll learn how to use a compare table to do calculations. Excited for your last desktop exploration before you earn your badge?