ChatGPT is an AI chatbot that can respond well to human questions. It has lately been all over the internet with examples of people pushing the limits, anticipating who it will fire, and marveling at its capacity to develop sophisticated solutions.
ChatGPT creating a bar chart with a reference line also solved the scenario with the condition with the calculated field as well using Windows function or say fixed LOD functions as well and it gave me almost end to end and that includes the addressing and partitioning as well in some of the cases it won’t satisfy but almost end to end. So, how knowledgeable is ChatGPT when it comes to Tableau? Watch the video below
let’s see how much it can solve right.
Question:
I’m using Tableau and I’ve created a bar chart to measure sales at the row shelf and dimension category and sub-category at the column shelf how can I create a reference line which can show average sales within each category and color the bars above this line with a different color? SoI just posed this question chatGPT and let us see what is outcome
Wow! it was quick enough to give me the step-by-step instructions within seconds. Now we need to check the validity and correctness of the given steps.
Let us try to just follow the steps:
Step 1:
Let’s open Tableau and do it from scratch.Drag the category and subcategory in the column shells and also drive the sales in a row.
Step 2:
Right-click on the “Sales” measure on the “Row” shelf and select “Add Reference Line”.
The average option under the value and the scope is per pane.
Step 3:
A calculation (above average) with Windows function.
Right-click anywhere in the “Data” pane and select “Create Calculated Field”.
In the calculation editor, enter the following formula.
SUM([Sales]) > WINDOW_AVG(SUM([Sales]))
This formula compares each bar’s sales value to the average sales value within each category.
Click “Apply” and then click “OK” to create the calculated field.
Step 4:
Click on the calculation (above average).
Select the compute using and then click the pane(across).
Everywhere crossing the average line its color is orange otherwise it’s blue.
So, the final View with chatGPT
By following these steps, you should now have a bar chart with a reference line showing the average sales within each category, and the bars above the average line will be colored differently, making them visually distinct. This visualization can help identify sub-categories with sales above or below the average more easily.