Exercises

Exercise 1 – Duplicate your analysis (optional but recommended)

  1. From left panel, select Analyses view and open the analysis you created in Build your first dashboard module by clicking on it.
    Look for analysis named SaaS-Sales.csv analysis or Module 1.
  2. Click Save As button from top right of the analysis screen.
  3. Enter Analysis name as SaaS-Sales analysis - Machine Learning.
  4. Click Save button.
  5. Close the Import complete message.
AuthorWorkshop-ML-Exercise

Exercise 2 - Optional - Multi metric forecasting
QuickSight supports forecasting multiple measures within the same line chart.

  1. Click on the first line chart to select it.
  2. Hover mouse pointer over the last / right most data point for Sales forecast and check the Expected forecast value.
  3. From left panel Fields list, click on Profit field.
    Note that the visual is now showing forecast for both Sales and Profit.
  4. For Sales forecast, Check the Expected forecast value for last / right most data point again.
    Note that the value is same as before. Each measure is forecasted independently. So, adding Profit to the chart doesn’t impact the forecast that is generated for Sales.
  5. From left panel Fields list, click on Profit field again to remove it from the visual.
AuthorWorkshop-ML-Exercise

Exercise 3 – Customize narrative formatting
The auto generated text that is included in narratives can be customized as needed. In this exercise, we will see how to add text formatting to the narrative.

  1. Click the ellipsis icon on your Period over Period insight’s visual menu and choose Customize narrative.
  2. In the narrative content, select increased by and change the text color to green.
  3. Select decreased by and change the text color to red.
  4. Towards end of narrative text, Click on PeriodOverPeriod.previousMetricValue.formattedValue and click the Bold button from top panel.
  5. Likewise, make PeriodOverPeriod.currentMetricValue.formattedValue bold as well.
  6. From top right of screen, click Save button.
AuthorWorkshop-ML-Exercise

Exercise 4 – Customize forecast computation
The actual content within the narrative can be modified as well. In this exercise, We will change the forecast period and change the narrative text as well.

  1. Click the ellipsis icon on your Forecast insight’s visual menu and choose Customize narrative.
  2. In right panel, click Computations to expand it and click the Pencil icon against ForecastInsight to edit it.
  3. Change the Periods forward value from 14 to 6, scroll down and click Save button.
  4. Select the text Total ForecastInsight.metricField.name is forecasted to be and delete it.
  5. In same cursor position (beginning of the line), type/paste in 6-month forecast:
    Don’t exit the narrative editor yet. We will make more changes in next exercise.
AuthorWorkshop-ML-Exercise

Exercise 5 – Add another forecast computation
Multiple computations can be included within the same insight visual. We will see how to add a 12-month forecast to our forecast insight.

  1. From right panel, click + Add computation button.
  2. Select Forecast as the Computation type and click Next button.
  3. Change the Periods forward value from 14 to 12, note that the computation name has been auto populated as ForecastInsight2, scroll down and Click Add button. ForecastInsight2 is now listed under right panel computations section.
  4. Copy the narrative text and paste it on to next line.
    Easiest way to do this is to click on static text like 6-month forecast, use your keyboard shortcut to Select all (CTRL-A or CMD-A), Copy (CTRL-C or CMD-C), Click on empty space after the narrative, add a new line using return/enter key and Paste (CTRL-V or CMD-V).
  5. Change the static text in second line to 12-month forecast:
  6. Click the ForecastInsight.metricValue.formattedValue variable. In the expression editor, add a 2 at end of first node of the variable name(so it reads ForecastInsight2.metricValue.formattedValue) and click Save button.
  7. Likewise, change ForecastInsight.timeValue.formattedValue to ForecastInsight2.timeValue.formattedValue.
    You should now be seeing different numbers and months in the preview below.
  8. From top right of screen, click Save button.
AuthorWorkshop-ML-Exercise

Exercise 6 – (Optional) - Add a control to selectively display 6-month or 12-month forecast
We can use logical code blocks within insight visual. In this exercise, we will use Inline IF to display either the 6-month or 12-month forecast based on value of an user control.

  1. From left rail menu, click Parameters and then click Create one from parameters panel.
  2. Enter Name as ForecastPeriod, Static default value as 6-month and click Create button.
  3. On next screen, click Control.
  4. Enter Display Name as Forecast period.
  5. Change the Style to Dropdown.
  6. Type / paste in following values into Define Specific Values box.
    6-month
    12-month
    (One value per line)
  7. Check the box for Hide Select all option from the control values if the parameter has a default configured.
  8. Click Add button.
AuthorWorkshop-ML-Exercise
  1. Click the ellipsis icon on your Forecast insight’s visual menu and choose Customize narrative.
  2. Delete the text 6-month in first line of narrative text.
  3. From right panel, click Parameters to expand it and click on ForecastPeriod parameter to insert it into the narrative.
  4. On first line, select the text ForecastInsight.metricValue.formattedValue for ForecastInsight.timeValue.formattedValue, click the Insert code dropdown and select Inline IF.
  5. In the expression editor, type / paste in ${ForecastPeriod}='6-month' and click Save button.
    You can also insert parameter from right panel instead of typing it in.
  6. Click at the end of first line, select the text 12-month forecast: in second line (so that the new line / line feed is selected as well) and delete it.
    You should see a single line in preview box now. There are both forecasts displayed currently. We will fix that in next step.
  7. Select the text ForecastInsight2.metricValue.formattedValue for ForecastInsight.timeValue.formattedValue, click the Insert code dropdown and select Inline IF.
  8. In the expression editor, type / paste in ${ForecastPeriod}='12-month' and click Save button.
    You should now see only one forecast in the preview box.
  9. From top right of screen, click Save button.
  10. Change the Forecast period control to 12-month and see the contents change in the Forecast insight visual.
AuthorWorkshop-ML-Exercise

Exercise 7 – Add anomaly detection insight
QuickSight’s Anomaly detection can spot trends in your data and can surface data points that deviates from their expected values. Let’s see how to set this up.

  1. From top left of screen, click + Add and then Add insight.
  2. Select Anomaly detection as the Computation type and click Select button.
  3. From the left panel Fields list, add Country, Customer, Order Date and Sales.
  4. Expand the Field wells section, click the Order Date field in Time field well and change the Aggregate to Month.
  5. From left rail, click Filter icon, click on Segment filter and change the All applicable visuals scope dropdown to Some visuals.
  6. Select all the visuals except Insight and click Apply button.
    This removes segment filter from the insight visual. We are doing this to have anomaly detection job analyze all the data in the dataset.
AuthorWorkshop-ML-Exercise
  1. From the insight visual, click Get started button.
  2. In Compute options > Combinations to be analyzed section, hover over the info icon to see the levels at which data will be analyzed.
    Note that with the default Hierarchical selection, since Customer field was selected after Country field, only overall sales, sales at country and sales at customer per country are being analyzed; Sales at customer level (across all countries) is not being analyzed.
  3. Change the Combinations to be analyzed to All and hover over the info icon to see the levels at which data will be analyzed.
    Note that the list now include sales at customer level as well.
  4. Scroll down if needed and click on the Top Contributors section to expand it. Click on Select fields dropdown and select Contact Name, Country and Product.
    Note that the right panel gives you a preview.
  5. From top right of screen, click Save button.
  6. From the insight visual, click Run now button.
    This will take a few minutes to run. Move on to the next exercise. We will return to this insight later to see the results.
AuthorWorkshop-ML-Exercise

Exercise 8 – Contribution analysis within time trends

  1. On the first line chart, click on the the data point for Sep 2020 and choose Analyze contributions to Sales.
    This will open the Contribution Analysis screen, which will help you drill into what drove that spike or drop to occur.
  2. From bottom part of screen, click Add a contributor.
  3. Select Country, Customer, and Product. Click anywhere outside the field selector to close it.
    The auto generated visuals show us which all countries, customers and products contributed the most to the increase in sales.
  4. In Contribution of Country to Sales visual, click the United Kingdom bar.
    Note that the other visuals get filtered to show just the data for United States, allowing us to drill further into what caused the change.
  5. Click the X in the upper right to exit the Contribution Analysis screen.
AuthorWorkshop-ML-Exercise

Exercise 9 – Contribution analysis within anomaly detection
Let’s return to the Anomaly Detection we set up in Exercise 7 and show how Contribution Analysis helps us drill into why anomalies have occurred as well (assuming it has finished running and you see results displayed in the Insight).

  1. Scroll down to the Anomaly detection insight visual and check the anomalies that are reported.
  2. From the visual’s bottom left, click Explore anomalies.
  3. Note that the first line chart showing anomaly for Amazon is in focus (blue border around the visual). Also, the left panel is showing contribution analysis for the fields we configured earlier - breaking down the month-over-month increase found in Amazon sales to help us determine why the increase happened.
  4. In left panel, click Configure against Top Contributors.
    This will allow you to add/change fields that you want to use for contribution analysis.
  5. Click on City from Fields list, scroll down and click Analyze button.
  6. Scroll down in the left panel to see the top cities that contributed to the change.
  7. Optional - Click on the Cisco systems line chart and see what contributed to that anomaly.
  8. Click < Back to analysis or the X in the upper right to close this screen and return to our analysis.
AuthorWorkshop-ML-Exercise