Explore & Enhance Topic

We saw in last module that we can put Q to work right after creating a topic. However, Q doesn’t know the data to the extent we do. There are additional configurations that we can make to give Q more pointers and thereby help Q tackle wider variety of questions more effectively. Let’s explore the topic options and enhance our topic in the process.

Exercise 1 - Optional - Click through the call to action prompts
You should still be in the SaaS-Sales topic view. If you traversed away, get back to this page by clicking Topics from QuickSight console’s left panel and SaaS-Sales from the listed topics.
The blue panel on top of the topics page is prompting you to take some actions - starting with excluding unnecessary fields. Click through these to get a quick tour the topic screens.
When building a topic of your own, these calls to action will ensure that you are covering these important aspects. For the current topic that we are building, more focused directions are provided in subsequent exercises.

QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 2 - Topic performance statistics

  1. Refresh your browser to reload the SaaS Sales topic summary page to show the latest stats.
    If you traversed away and had skipped last exercise, get back to this page by clicking Topics from QuickSight console’s left panel and SaaS-Sales from the listed topics.
  2. Note that we have the option to see the usage and feedback for periods ranging from 7 days to 12 months. Also, if desired, we can choose to exclude questions that couldn’t be answered and the ones that didn’t have any user feedback.
    This view is currently just showing the summary of our own limited interaction with Q. Once a topic is published to your end users, this view will let you gauge the overall usage and user sentiment very easily.
  3. Click on QuickSight icon to exit the topic view.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 3 - Add a new dataset We can include multiple datasets in the same topic. Q will select the dataset to query based on the fields or time granularity specified in the question. Let’s first create a new dataset.

  1. Open Datasets view from left panel and click New dataset button.
  2. Select S3, enter following details
    Data source name: SaaS-Sales-MonthlySummary
    Manifest file URL: s3://ee-assets-prod-us-east-1/modules/337d5d05acc64a6fa37bcba6b921071c/v1/SaaSSalesMonthlySummaryManifest.json
    and click Connect button.
  3. On Finish dataset creation dialogue, click Edit/Preview data button.
  4. In Data prep view, click Save & publish button.
  5. Click QuickSight icon to exit data prep view.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 4 - Include new dataset in Q topic
Additional datasets can be added to a topic by selecting the datasets we want to add. Alternatively, If we have dashboards that are using multiple datasets and we want to include all of those datasets in same topic, we can choose the Import dashboards option. We will use the Add datasets route for this exercise.

  1. Launch Topics view from left panel and click on SaaS-Sales topic to open it.
  2. Scroll down on Summary tab to Datasets section and click the Add datasets button.
  3. Select the check box against SaaS-Sales-MonthlySummary.
    Search for SaaS-Sales if the dataset is not present in the initial list
  4. Click the Add datasets button.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 5 - Configure time basis
Time basis setting is used to specify the date granularity of the dataset. This will help Q route queries to the optimal dataset.
This is more useful when you have direct query datasets having data at different time granularities. We are doing this with SPICE datasets for ease of trying this out in workshop setting.

  1. Expand SaaS-Sales dataset entry, set the Time Basis to Daily and Default date to Order Date.
  2. Likewise, for SaaS-Sales-MonthlySummary, set the Time Basis to Monthly and Default date to Order Date.

Since Q is still indexing the summary dataset, we will test the above settings later on in this module.

QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 6 - Configure refresh schedule
Q’s index has to be refreshed as new data points are added to enable Q to provide type aheads for new categories and answer questions involving them.
For Direct Query datasets, there is option to set a time based schedule for this refresh. For SPICE datasets, we can setup the index to be refreshed when underlying dataset gets refreshed.

  1. From SaaS Sales MonthlySummary dataset’s expanded view, click the Add schedule button.
    This can be accessed directly from the menu options of collapsed dataset entry as well.
  2. Check the box against Refresh topic when dataset is imported into SPICE.
  3. Click Save.

You can see this in action by triggering a dataset refresh on SaaS-Sales-MonthlySummary (from dataset menu) tomorrow (as Q refresh is triggered automatically only for one SPICE refresh per day). Then, check the topic and you will see that the Q automatically refreshes it’s index based on our setting.

QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 7 - Exclude unnecessary fields
We can exclude unnecessary fields from the topic to prevent them from showing up in results and type aheads.

  1. Scroll up and click on Data tab.
  2. Fields from all included datasets are displayed by default. Click on the View drop down and deselect SaaS Sales MonthlySummary.
    Now we are seeing fields from just SaaS Sales dataset.
  3. Note that we have Row ID and Date Key fields that don’t particularly add any value to end users.
  4. Type into Q bar - Show me sales by date Note that Date Key and Order Date are showing up as suggestions.
    If you submit the question, Q will return the result based on Order Date itself. To make the user experience better, we can exclude the key field and avoid it showing up as a type ahead option.
  5. Click the Slider against Row ID and Date Key fields to exclude them from the topic.
  6. Clear the Q bar and type the question again - Show me sales by date.
    Note that Date Key is no longer provided in type ahead options.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 8 - Add field synonyms
We have a field named customer. End users might refer to customer as Company, Org or Organization as our sales are to other businesses. We can enable Q to answer such questions by adding relevant synonyms. We will see how to do this via Q bar as well as directly in the field definition.

  1. Ask Q - Show me sales by company We don’t have any fields named company in this dataset. So, Q will ask What did you mean against the term Company.
  2. Type Customer in search box and select it from returned results.
  3. Click suggestion icon to open the suggestion panel and click Save button to save company as a synonym for customer.
  4. Refresh your browser and search for customer field.
  5. Note that company has been added as a synonym.
  6. Hover mouse to the right of company in the synonyms column and click the + icon that appears. Type Org into the box and hit enter/return key to save.
  7. Add Organization as another synonym.
  8. Ask Q - Show me sales by org
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 9 - Add value synonyms
Like we did for field names, we can add synonyms for category values as well. Let’s see how to do this via Q bar and field definition.

  1. Ask Q - Show me sales trend for UPS We have United Parcel Service as the customer name in our dataset. So, Q doesn’t find any matches on UPS and will ask us What did you mean?.
  2. Type United Parcel Service in search box and select it from returned results.
  3. Click suggestion icon to open the suggestion panel and click Save button to save UPS as a synonym for the value United Parcel Service.
  4. Click on Customer field’s row / V control to expand it.
  5. Click Configure value synonyms and note that UPS has been added as a synonym for United Parcel Service.
  6. Click Add button, search for United and select UnitedHealth Group.
  7. Click pencil icon under synonyms column, type in UHG and hit enter/return key to save.
  8. Close the dialog by clicking Done button.
  9. Ask Q - Show me sales trend for UHG
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 10 - Add aggregation settings
We specify the aggregation we want to use as default and the aggregations that we don’t want to allow at all. Let’s see this in action.

  1. Ask Q - Show me customers by month
    Q will show us a line chart plotting count of customers against month.
    Note that for Dec 2021, customer count is 477. Since this is a regular count, if a customer placed 10 orders for Dec 2021, that customer is being counted 10 times here.
  2. Ask Q - show me unique customers by month
    Note that the axis range of the resulting line chart is smaller now. For Dec 2021, we see that there are orders from 84 distinct customers.
  3. In Customer field definition, change Default aggregation to Count distinct.
  4. Ask Q - Show me customers by month Q now shows us the distinct customer count per month though we didn’t explicitly ask for it.
  5. In Customer field definition, change Not allowed aggregation to Count distinct.
    Note that the default aggregate setting gets removed.
  6. Ask Q - Show me unique customer count per month
    Q ignores the request for unique count and just shows us regular count of customers.
    Note - As of now, you can still get the distinct count through the restatement field menu. This has been reported and will be addressed in near future.
  7. Optional - Remove the Not allowed aggregation setting.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 11 - Add semantic info
Providing more details on the field context will help Q answer more natural language questions. For example, users might ask who purchased the most from us in 2021. Let’s see how we can enable Q to tackle this question.

  1. Ask Q - who purchased the most in 2021 We haven’t set semantic info for any fields in our dataset yet. So, Q doesn’t know what fields can be associated with who and asks us what we meant.
  2. In Customer field definition, change Semantic type to Organization.
  3. Click to the right of the question in Q bar and submit it again by hitting the enter/return key.
  4. Q now asks us what we meant by purchased.
    Click on the word who and we can see that Q has associated that to Customer based on the semantic setting we did in last step.
  5. Click on word Purchased, search for Sales and select it from the results.
    Q now shows us the top customers from 2021.
  6. Optional - Click the suggestions icon to open the suggestion panel and click Save button to save purchased as a synonym for sales.
QWorkshop-ExploreEnhanceTopic-Exercise

Likewise, setting semantic type of Contact Name field to person will enable Q to surface it as an option in answering who based questions.

Exercise 12 - Bulk actions
When we got to make the same setting across multiple fields, we can leverage the bulk actions option.

  1. Clear the field search by clicking the x in field search box.
  2. From View, ensure that both datasets are selected. If not, click Select all option.
  3. Select the checkboxes against both instances of Sales and Profit fields. You can utilize the field search for easily locating these fields.
  4. Click the Bulk Actions button.
  5. In the Bulk Actions dialogue, do the following configurations
    Default Aggregation : Sum
    Semantic type : Currency
    Semantic sub-type : USD
    Value format : $Dollar
    and click Apply to 4 button.
  6. Resubmit last question in Q bar (who purchased the most in 2021)
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 13 - Query routing
We added monthly summary dataset in a prior step. Let’s see how queries are being routed to appropriate dataset based on the question.

  1. Ask Q - Show me daily sales chart Check the restatement. Q has routed this query to SaaS-Sales dataset as we had specified that this dataset’s Time basis as Daily.
  2. Ask Q - Show me monthly sales chart
    Q used SaaS Sales MonthlySummary to answer this question as we had specified it’s Time basis as monthly.
  3. Optional - Try changing the question to ask for weekly, quarterly and yearly sales charts. Q will use SaaS Sales for answering weekly and SaaS Sales MonthlySummary for quarterly and yearly questions.
  4. Ask Q - Show me monthly sales by country The summary dataset doesn’t have country field. So, Q uses SaaS Sales dataset to answer this question.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 14 - Add a calculated field
Let’s say we want to calculate the True cost of a product. We have Sales and Profit fields available in the dataset. So, we can easily calculate the True cost.

  1. Click the Add calculated field button.
  2. Type in the name as True cost.
  3. From right panel, select SaaS Sales dataset.
  4. Click the expression box and type in Sales - Profit. Utilize the type aheads as needed.
  5. Click the Save button.
  6. Ask Q - Show me sales, profit and true cost by product
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 15 - Add a filter
Let’s say lot of analysis is expected on sales for the two big customers - Siemens and Anthem. We can add a filter to allow for easy selection of these two customers. Further, if we want to only allow analysis against data for these two customers, we can choose to always apply this filter or apply it as default choice but allow end users to ask questions about other customers as well.

  1. Click Add filter button.
  2. Configure as follows and click Save button.
    Name: big2
    Dataset: SaaS Sales
    Field: Customer
    Filter type: Custom filter list
    Rule: Include
    Values: Siemens, Anthem
    (Enter each value separately. You should see two value pills once done.)
  3. Ask Q - Show me sales by customer for big2
    Q gives you the filtered result with just data for the two customers.
  4. Let’s explore other filter options.
    Search for big2, expand the filter row and Select the checkbox for Apply the filter anytime the dataset is used
    This will force the filter to be applied for all queries.
    Ask Q - Show me sales by customer
    Q will now return data only for big2 even though we didn’t ask for it in the question.
    Ask Q - Show me sales by customer for Lukoil
    As expected, Q tells us that No data was found.
  5. Let’s say we want to apply big2 filter as a default but want to allow customers to ask questions about other customers as well. For this, change the radio button selection in filter definition to Apply always, unless a question results in an explicit filter from the dataset
    Ask Q - Show me sales by customer
    Note that Q still returns data for big2 by default.
    Ask Q - Show me sales by customer for Lukoil
    Q is now able to return data for other customers as well when asked for it. What do you think will happen if we ask for big2 and Lukoil? Ask Q - Show me sales by customer for big2 and Lukoil
  6. Deselect the checkbox for Apply the filter anytime the dataset is used.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 16 - Add a named entity
We can defined named entities if we need to show users a combination of fields. For example, when someone asks for order details, it makes sense to show them order date, order id, product name, customer name and customer contact name. We can make this happen by defining a named entity.

  1. Click the Add named entity button.
  2. Configure as follows and click Save button.
    Dataset: SaaS Sales
    Name: Order details
    Select fields: Order date, Order ID, Product, Customer, Contact Name.
  3. Ask Q - Show me order details for big2 in 2021
    Note that Q rightly interprets the time range, associates our ask to the named entity and returns the expected result.
  4. Click on QuickSight icon to exit the topic view.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 17 - Create a dashboard with monthly product sales visual
Let’s create a simple dashboard with one visual showing monthly product sales for 2021. We will then see in next exercise how to explicitly link this visual to a question in Q.

  1. Click Datasets from left panel and then on SaaS-Sales dataset.
  2. Click Create analysis button.
  3. Change the analysis name to SaaS Sales - Manually linked visuals.
  4. With the empty visual selected, change visual type to Vertical stacked bar chart.
  5. From Fields list, click Order date
  6. From Field well, access Order Date field menu and change aggregate to Month.
  7. From Fields list, click Product and Sales to include them in the visual.
  8. Click the visual title, remove auto populated value and type in Monthly Product Sales Chart.
  9. Click Share and followed by Publish dashboard.
  10. Enter new dashboard name as SaaS Sales - Manually linked visuals and click Publish dashboard button.
  11. Click QuickSight icon to exit dashboard view.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 18 - Review user activity and manually link a visual
All the questions asked on the topic will be visible in User activity tab. You can click the View link against these questions to see the response Q generates for them and take action where necessary.

  1. Click Topics from left panel and then on SaaS Sales topic.
  2. Open User Activity tab.
  3. Click View on Show me order details for big2 in 2021
  4. Click Mark as reviewed. If this question is asked again, the result will be displayed with a reviewed badge to provide extra confidence to end users.
  5. Filter the questions to the ones that Has comments.
  6. Click on Show me monthly product sales chart to expand it.
    We can now see the comment that user wants to see this as a vertical stacked bar.
  7. Click on the View link. Q shows us the data in tabular format. (As mentioned earlier, the reader could have changed the visual type easily. You can do that as well and then mark this as reviewed to have that chart selection stick with this question. However, we have already tried changing visual types in a prior exercise. So, let’s use this opportunity to see how to manually link a visual to this question.)
  8. Click on Link to visual.
  9. Expand SaaS Sales - Manually linked visuals > Sheet 1 and select Monthly Product Sales Chart.
  10. Check the Visual preview to ensure that you picked the right chart (in scenarios wherein you are picking from a multi visual dashboard) and click Link visual button.
  11. Try resubmitting the question from Q bar.
    Q now shows the linked visual in response. It is tagged with a reviewed badge and Q also provides info that this visual has been linked from SaaS Sales - Manually linked visuals dashboard.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 19 - Add custom message and explore verified answers We can have Q return custom messages based on keywords present in questions. Also, Q gives us a view to see all verified answer along with stats on them and option to remove them as well.

  1. Click on the Show me quota for next year row to expand it and see the comments.
    This shows the comment we left earlier stating I’m not able to get quota details for next year. We can add a custom message informing users that questions on quota is not currently supported.
  2. Shift to Verified answers tab and click on Custom message.
  3. Type in quota into keywords and click Save.
  4. Ask Q - Show me quota for next year Q now shows the custom message informing user that questions on quota is not currently supported.
  5. Click on the row for Show me monthly product sales chart to expand it.
  6. Click Remove button.
  7. Ask Q - Show me monthly product sales chart.
    Q now returns to showing the table as the starting view.
QWorkshop-ExploreEnhanceTopic-Exercise

Exercise 20 - Share the topic
Once the topic is setup to our satisfaction, we can share it with our end users. Be sure to keep track of the topic performance and make further enhancements as needed.

  1. Click Share link from top right of the topic screen.
  2. Search for users / groups and add them to share list. For end users, ensure that the permission level is set to Viewer.
  3. Click Share button.
QWorkshop-ExploreEnhanceTopic-Exercise