Spotter best practices
Understand Spotter’s capabilities
What questions can Spotter answer today?
Spotter brings in the ability to translate natural language instructions to analytical queries on your data model that can help you perform some complex analysis. Let’s take a look at the capabilities of Spotter in more detail by taking a simplified table given below.
Region |
Month |
Total sales |
East |
Jul 2024 |
4,000,000 |
East |
Aug 2024 |
4,000,000 |
East |
Sep 2024 |
4,000,000 |
Midwest |
Jul 2024 |
5,000,000 |
Midwest |
Aug 2024 |
5,000,000 |
Midwest |
Sep 2024 |
4,000,000 |
South |
Jul 2024 |
1,000,000 |
South |
Aug 2024 |
1,000,000 |
South |
Sep 2024 |
1,000,000 |
Southwest |
Jul 2024 |
3,000,000 |
Southwest |
Aug 2024 |
2,000,000 |
Southwest |
Sep 2024 |
2,000,000 |
West |
Jul 2024 |
4,000,000 |
West |
Aug 2024 |
4,000,000 |
West |
Sep 2024 |
3,000,000 |
Currently, Spotter can help you answer questions about your data which can be answered by using a combination of the capabilities mentioned below:
- Mathematical computations
-
Spotter can count things in your dataset (for example,
how many regions are there?
) , or it can aggregate metrics (for example,what is the average sales?
) or it can perform complex mathematical computations (for example,how does the sales for the east region compare against sales of the west region?
). - Grouping
-
Spotter can help you perform the computations for specific groups (for example,
what is the total sales by region?
orwhat is the maximum sales for each region?
). You can also ask Spotter to create grouping on date columns on the fly (for example,what are the yearly sales?
orwhat are the monthly sales?
). - Filtering
-
You can instruct Spotter to perform the above operations on a filtered set of data instead of the full table. For example,
what are the total sales for August?
orwhat are the sales for this month?
orwhat are the sales for South in July 2024?
Here is a quick glance of the kind of questions you can ask using a combination of the above skills.
- Basic Aggregations
-
Spotter supports basic aggregations, which act as building blocks for more complex calculations, using keywords like sum, average, count, and unique count. These can be used on any numerical column, and can be grouped by other columns.
- Examples
-
sum [sales_amount]
calculates the total sales.
average [quantity_sold] by [product_category]
calculates the average quantity sold per product category.
count [order_id]
counts the number of orders.
unique count [customer_id]
counts the number of unique customers.
- Growth Calculations
-
Spotter computes percentage change over time with the growth of keyword. This is particularly useful for trend analysis.
- Examples
-
growth of [revenue] by [order_date].yearly
shows the year-over-year revenue growth.
growth of [quantity_sold] by [order_date].monthly
shows the monthly growth in quantity sold.
- Moving/Cumulative Calculations
-
The system can perform moving and cumulative calculations. These are useful for tracking trends over time.
- Examples
-
cumulative_sum ( [sales_amount] , [order_date])
calculates the cumulative sum of sales over time.
moving_sum ( [sales_amount] , 0 , 0 , [order_date] )
gives the current sales amount.
moving_average ( [sales_amount] , 4 , 0 , [order_date] )
calculates the five-month moving average of sales (note the window is of four previous values plus the current value).
- Arithmetic Operations
-
- Example
-
To calculate profit, you might use a formula like
[sales_amount] - [cost_of_goods_sold]
.
- Conditional Logic
-
- Example
-
To categorize products based on their sales, a formula like
if ( average [sales_amount] > 1000000 ) then 'red' else 'blue'
can be used.
- String Manipulation
-
Formulas can include string functions for operations like concatenation.
- Example
-
You can combine the first three letters of product_name with the last three of product_category using a formula like
concat ( substr([product_name] , 0 , 3 ) , '-' , substr([product_category] , length - 3 , 3 ))
.
- Date Functions
-
- Examples
-
You can use date functions in formulas such as
diff_years([order_date], today())
to compute the difference in years from the current date.
To filter for the correct week number, one can use formulas such asdiff_weeks(date, to_date('12/02/2024', '%d/%m/%y')) = 0
.
- Aggregations with Conditions
-
- Examples
-
group_aggregate ( sum ( [sales_amount] ) , { }, { [sales_amount] < 50000000 } )
calculates the sum of sales from small orders.
To compute the sum of sales_amount for specific products, usesum_if (right([product_name], 6) = 'shirts', [sales_amount])
.
- Comparisons
-
The vs keyword is used to compare values, time periods, or attributes.
- Examples
-
[sales_amount] [order_date] = 'this year' vs [order_date] = 'last year'
compares this year’s sales to last year’s.
[sales_amount] [region] = 'Midwest' vs [region] = 'East'
compares sales in two different regions.
- Change Calculations
-
Spotter can perform calculations to compute the change between values, often over time, or between attribute values. This is often done using formulas involving date and math functions, or with moving sums.
- Example
-
([sales_amount] in q2 2024 - [sales_amount] in q1 2024) / [sales_amount] in q2 2024 * 100
calculates the percentage change in sales between two quarters.
- Subqueries
-
Subqueries allow for more complex filtering and analysis by using the results of one query to filter the results of another.
- Example
-
To find the top 10 customers by sales and then show their orders, use
[order_id] [customer_id] in (top 10 [customer_id] by [sales_amount])
.
Analysts can provide training examples to help Spotter learn computation logic specific to their business. Without them, Spotter will generate these based on the details provided in question. Some of the computations listed above will not be supported with aggregated fields. For example, if the analysts creates a group aggregate formula at worksheet level then tries to use the same in creating another group aggregate formula at answer level then those computations are not supported. |
What questions are currently out of scope?
Spotter is currently not designed to answer other types of questions. A few types of questions that Spotter doesn’t answer well are listed below.
"Why" questions are not yet supported in Spotter and should be avoided. For example, Why did my sales go down in Q2? Spotter is not able to answer descriptive questions about data sources. For example, How many columns does the Worksheet have? Spotter can not change chart types. You can go to Edit Answer from the context menu to access additional chart types.
Spotter user interface
Let’s take a look at the Spotter user interface to understand how users can use the various options available. Spotter is designed as a conversational experience. The image below highlights some of the key elements:
- User Input
-
The user input area is available at the bottom of the screen. You can use this to ask questions to the AI analyst or provide instructions on how the AI analyst should modify the answer.
All follow-up questions in Spotter are treated as a follow-up to the last question. If you want to start with a new question, we recommend using the New chat option to reset the conversation. - Last User Input
-
Shows how your historical questions are displayed in the conversation.
- Interactive Chart
-
Interactive chart is one of the elements of the response generated by Spotter. You can interact with the chart (similar to other parts of the ThoughtSpot product).
Only the last answer in the conversation supports interactive charts. - Data Source
-
Shows the data source used for the conversation. You can change the data source from here if you want to start conversations on a different data source.
Spotter conversations started from a Liveboard do not allow changing the data source.
- Changes from Last Step (verification)
-
Whenever you ask a follow-up question in the conversation, Spotter’s response includes the changes made from the last step to help you verify what has changed from the previous step.
The changes from Last Step are not currently available in saved chats. - Query Tokens (verification)
-
All answers in Spotter show query tokens. These query tokens represent the simplified query and they uniquely specify how the data shown in the answer was computed. You can use the query tokens at any step to verify the complete answer.
- Switch Table/Chart (verification)
-
You can choose to view any answer in table view or chart view. The chart views are helpful for consuming simple answers while the table view is useful when the number of columns in the generated answer cannot be visualized elegantly in any chart.
- Edit user input (correction)
-
You can use the edit user input option to make modifications to your last question and make it more precise. Editing the latest user input will generate a new response using the edited instructions.
The option to edit user input is only available on the last question you asked. - Delete (correction)
-
Generating insights sometimes requires a fair bit of exploration of the data. You can remove follow-up questions in case you want to go back to a previous state in the conversation and deep-dive in a different direction.
The option to edit user input is only available on the last question asked. Once the user input is deleted, the answer associated with it is also deleted. - Edit Answer (correction)
-
You can take control and modify the answer or visualization settings using our keyword-based search interface. It’s useful when you want to explore the data set in Do it yourself mode. You can always make modifications to an answer and come back to the conversation to ask more questions on the modified answers.
The option to edit the answer is only available on the last question asked by the user.
- Answer Actions
-
You can download the answer generated during the conversation. You can also save or pin the answer from the conversation when using Spotter in Cloud.
- Preview Data
-
Preview data shows a few rows from the data source to help you check what columns are available for analysis in the selected data source. Preview Data is currently unavailable for data sources which contain a chasm trap.
- New chat / Reset chat
-
All questions in the conversational experience are treated as a follow-up to the previous answer. If you want to start a new analysis with a fresh question, use this option to start a new conversation.
Spotter on Liveboards only provides the option to reset chat. When the chart is reset, you go back to the initial visualization from which the conversation started. - Feedback
-
Use the feedback option to inform us and your analytics team about which questions are not working.