Is ChatGPT a reliable Tableau assistant? Sort of? Not really.
Prompt: What is ChatGPT?
Output: ChatGPT is a natural language processing (NLP) chatbot powered by OpenAI's GPT-3 language model. It is designed to generate human-like conversations in response to user input.
The output above is what is returned by the AI given the prompt question, "What is ChatGPT".
The applications for ChatGPT are now being put to the test by tens-of-thousands of users whether it be creating a Shiny App in R without writing any code, answering job interview questions, or writing a tutorial blog on plotting with pandas and matplotlib packages in python.
Here is a great thread by Ben Tossell, highlighting some of the best examples of ChatGPT in action.
Seeing so many different use cases on Twitter, I started wondering how ChatGPT would perform when given Tableau related prompts. As a Data Analyst who's go to tool is Tableau, should I start worrying about looking for a new job?
Let's see how reliable ChatGPT is in providing instructions on how to build visuals in Tableau. The first thing to figure out is how to go about testing the AI. Why not ask it?
Prompt: How would be the best way to test ChatGPT in providing directions on how to build visuals in Tableau?
Output: The best way to test ChatGPT in providing directions on how to build visuals in Tableau would be to create a series of test scenarios that involve building visuals in Tableau. For each scenario, the user should provide the ChatGPT with the necessary information and then observe how the ChatGPT responds. The user should then evaluate the accuracy and completeness of the ChatGPT's response and make adjustments as necessary.
Okay, sounds simple enough. Let's start with something small, like building a bar graph.
Prompt: How do I create a bar graph in Tableau?
1. Open Tableau and connect to the data you want to use to create the bar graph.
2. Select the ‘Sheet’ tab located at the bottom left corner of the Tableau window.
3. Drag a dimension field from the data pane to the Columns shelf.
4. Drag a measure field from the data pane to the Rows shelf.
5. Select the ‘Show Me’ tab located at the top right corner of the Tableau window.
6. Select the bar graph icon from the Show Me window.
7. Your bar graph will be displayed in the visualization pane.
8. You can customize your bar graph further by changing the color, size, labels, and other formatting options.
Look at that, ChatGPT recognized that bar graphs need one dimension and one measure field. The AI makes use of the 'Show Me' menu, even indicating the location of the menu in Tableau Desktop and provides additional customization options that are available in the last step.
Now, let's check how changing the wording in the prompt affects the AI's output.
Prompt: Provide instructions on how to create a bar graph in Tableau
1. Open Tableau and connect to the data source you want to use to create your bar graph.
2. Drag the dimension you want to use for the x-axis onto the Columns shelf.
3. Drag the measure you want to use for the y-axis onto the Rows shelf.
4. Select the Show Me tab and select the Bar Chart option.
5. Adjust any additional settings, such as color, size, labels, etc.
6. Click the Sheet 1 tab to view your bar graph.
What is interesting here is that the output now includes the axes that correspond with the Columns and Rows shelf in Tableau while again utilizing the 'Show Me' menu to specify the bar chart option.
I'm curious how instructions change when specifying the AI not to use the 'Show Me' menu.
Prompt: Provide instructions on how to create a bar graph without using the "Show Me" button in Tableau
1. Open the Tableau workbook and select the worksheet that contains the data you want to create a bar graph from.
2. Drag a dimension field such as “State” to the Columns shelf.
3. Drag a measure field such as “Sales” to the Rows shelf.
4. Right-click on the measure field you dragged to the Rows shelf and select “Bar” from the context menu.
5. Right-click on the dimension field you dragged to the Columns shelf and select “Sort” from the context menu.
6. Select the desired sorting option (e.g. Ascending or Descending).
7. To add labels to the bars, right-click on the measure field in the Rows shelf and select “Add Label” from the context menu.
8. To further customize the graph, select the “Format” tab from the top menu and choose the desired options.
So ChatGPT was able to provide instructions without using the 'Show Me' menu and even included the option to sort the bars in ascending or descending order. However, step 4 is incorrect as you need to go to the Marks pane to select 'Bar', not the measure in the Rows shelf. Step 7 also has a similar issue since right clicking the measure field in the Rows shelf to add labels to the bars isn't possible either.
Let's shift to a more open-ended prompt, asking what visual type would be best to visualize fields called 'Order Date' and 'Sales'.
Prompt: What visual type would be best to visualize 'Order Date' and 'Sales' in Tableau? Please provide instructions on creating the visual in Tableau
Output: The best visual type to visualize 'Order Date' and 'Sales' in Tableau is a line chart. To create this visual in Tableau, follow these steps:
1. Open Tableau and connect to your data source.
2. Drag the 'Order Date' field to the Columns shelf.
3. Drag the 'Sales' field to the Rows shelf.
4. Right-click on the 'Order Date' field and select 'Continuous'.
5. Right-click on the 'Sales' field and select 'Measure'.
6. Select the 'Line' chart type from the Show Me menu.
7. Adjust the chart as desired.
ChatGPT correctly identifies a line chart as the best visual type given that one of the fields is a date field. The instructions specify changing 'Order Date' to a continuous variable which isn't necessarily needed. Step 5 is slightly off since 'Measure' isn't an option that can be selected, the type of aggregation can be; i.e. sum, average, median, etc. Close, but no cigar.
How does it perform with writing calculations?
Prompt: Create a calculation that sums 'Sales' if year of 'Order Date' is 2016
Output: Create a calculated field:
SUM(IF [Order Date] = '2016' THEN [Sales] END)
The calculation is almost there, with the only needed changes being adding the YEAR function around 'Order Date' and removing the quotes around 2016.
What about a visual type that isn't native to Tableau?
Prompt: How can I create a sankey graph in Tableau?
Output: Tableau does not natively support Sankey graphs, but there are several ways to create a Sankey graph in Tableau. One way is to use a third-party plugin such as SankeyMatic. This plugin allows you to easily create Sankey diagrams in Tableau using your data. Another option is to use a custom visual such as the Sankey Diagram from The Information Lab. This custom visual can be downloaded from the Tableau Marketplace and allows you to quickly create Sankey diagrams from your data. Finally, another option is to use a chart type such as the Stacked Bar Chart to create a Sankey diagram. You can use the calculated fields feature in Tableau to calculate the flow of the data, and then use the Stacked Bar Chart to create the visual.
The AI offers an alternative way to create a Sankey graph using SankeyMatic, saying it is a plugin that can used in Tableau, but this is not true. SankeyMatic is a site where you can build a Sankey graph, but this cannot be connected to Tableau. The second option mentions The Information Lab which does have a tutorial blog post on Sankey graphs that can be viewed here, but this "custom visual" cannot be downloaded from the Tableau Marketplace. The last option is correct, but the calculations aren't provided. Perhaps asking for the calculations will be fruitful?
Prompt: Write the calculations needed to create a Sankey graph in Tableau
1. Calculate the size of each bar: [Measure]/TOTAL([Measure])
2. Calculate the flow between bars: [Measure]/PREVIOUS_VALUE([Measure])
3. Calculate the cumulative size of each bar: SUM([Measure])/TOTAL(SUM([Measure]))
Yeah, that's not right at all.
So should you worry about ChatGPT taking your data vizzing job? No. ChatGPT just isn't reliable enough for a non-experienced user to know what is correct or not. While it gets some of the basic instructions right, going to more complex visuals and calculations can cause some issues. ChatGPT says it best:
Prompt: Will AI replace data visualization developers?
Output: No, AI will not replace data visualization developers. AI can be used to automate certain data visualization tasks, such as producing basic charts and graphs. However, AI is not yet capable of creating complex data visualizations that are tailored to a specific purpose or audience. Data visualization developers are still required to create custom visualizations that can effectively communicate data insights.
ChatGPT has the potential to be a very powerful tool used in conjunction with experts to increase productivity in a myriad of fields, but not powerful enough to replace said experts as demonstrated above. This is why sites like Stack Overflow have temporarily banned ChatGPT generated text due to its inconsistency while having the appearance of being correct.
If you are interested in learning more about the potentials of generative AI and how it will change the way we work, I highly recommend reading this blog post by economist Noah Smith and AI-researcher roon. While it isn't by any means perfect and more work needs to be done to improve its accuracy, programs like ChatGPT are exciting as it shows a glimpse of a new potential paradigm shift. AI is already making a large splash and ChatGPT may just be the beginning.
By Michael Dunphy
Published Dec. 7, 2022