We prepared for you today a new Tableau challenge, more precisely all the steps about how to create a Scrolling Bar Chart Animation. Animations in Tableau are available starting with the Tableau 2021.1 version. Creating animations can be challenging because you must control all the dimensions in your view.
In order to create a Scrolling Bar Chart in Tableau, please follow these steps:
→ In Tableau Desktop, connect to Sample – Superstore sample data provided by Tableau.
→Create a new calculation called [Order Date | Week]. This calculation will just be the rounded week.
DATETRUNC(‘week’, [Order Date])
→Add this to columns as a continuous exact date.
→Add [Order ID]to rows and change the aggregation to COUNTD().
→Create a new parameter called [Baseline Date]. This parameter will eventually be tied to the [Order Date | Week] calculation you just created.
→Create calculated fields: [Start]and [End] will be used to create a band using a reference line.
→[Start]returns the larger of two values: either 200 days less than the [baseline date] or the earliest day in the dataset.
MAX([Baseline Date] – 200, {MIN([Order Date | Week])})
→[End]returns the smaller of two values: either 200 days more than the [baseline date] or the latest day in the dataset.
MIN([Baseline Date] + 200, {MAX([Order Date | Week])})
→[Color]returns a boolean if the values between or equal to +/- 200 days from the [baseline date].
[Order Date | Week] >= ([baseline date] – 200)
AND
[Order Date | Week] <= ([baseline date] + 200)
→Add [Start]and [End] to Detail of the marks card. And add [color] to color.
Step 4: A reference line for the baseline visualization
→Add a reference band on the [Order Date | Week] Have the band run from [Start]to [End].
→Create a new calculation called [Adjusted Date]. This will be the [Order Date | Week] minus the [baseline date].
[Order Date | Week] – [baseline date]
→Add this calculation to columns as MIN() aggregate.
→Also, add COUNTD([Order ID]) to rows.
→Add [Order Date | Week] to detail on the marks card and be sure it’s a continuous exact date.
→Change the mark type to bar.
→On the Size button on the marks, card select fixed, type in 7 (for the days in a week), and choose left for alignment.
→Edit the axis on MIN([Adjusted Date]) axis. Set the values to run from -200 to 200.
→Create a new calculation called [Top]This will also be used for a reference line. [Top] calculates the maximum number of orders in a week.
{MAX({FIXED [Order Date | Week] : COUNTD([Order ID])})}
→Create another calculation called [0] where the value is set to 0.
→Add both calculations to detail.
→Add a reference band on the rows axis of COUNTD([Order ID]).
→Set the band to run from [0] to [Top].
→On rows, double click to the right of your existing value and type MIN(-0.001).
→Choose Bar for the mark type and set the size of the bars to fixed, size 7 (for days), and left-aligned.
→Create a dual-axis chart and synchronize the axes
→Create a new calculation called [Axis Label]. This will be the label of the axis. This can be any number of labels but for my calculation, I am going to label every other bar in MMM-D, ‘YY format.
IF (DATEPART(“week”, [Order Date | Week]) %2) = 1
THEN LEFT(STR(DATENAME(“month”,[Order Date | Week])),3)
+ “-” + STR(DAY([Order Date | Week]))
+ ” ‘” + RIGHT(STR(YEAR([Order Date | Week])),2) + ” –”
END
→Add this calculation to labels on the MIN(-0.001) marks card.
→Set the label direction to up and the vertical alignment to the bottom.
→Add the two sheets to a single dashboard.
→Add a parameter action on the dashboard. When [Order Date | Week] is selected from the baseline visualization, the [Baseline Date]parameter should be updated with that date.
→On the Main Menu go to Format → Animations. Turn animations on and set the duration to 2.00 seconds and the style to simultaneous. This will give the scroll a dramatic effect.
If you like video tutorials, we recorded for you the entire process as you can see in the #skillpill video below, created by our colleague Andreea Chiriac, Data Analyst.
As Tableau Software Premier Partner we are continuously advising and supporting our customers in using Tableau for data analysis on a daily basis. This means understanding data and its evolution through creative and insightful dashboards. Our team of Data Analysts are qualified to explain and guide the company’s internal data teams in the journey to become more data-driven.
We hold the technical and sales certifications for all products: Tableau Desktop, Tableau Server, Tableau Prep, Tableau Data Management.
With Tableau Software – the best data visualization platform – you can always understand your business or your job better. Using Tableau, you will take smart and strategic decisions and you will quickly understand the data flow, numbers and results it produces.
Are you interested in learning more about one of the best analytics tools and implement the solution in the entire company? Contact us!
In Tableau, “Measure Names” is a special field that automatically includes all the measure names (numeric fields) in your data source. It’s a dynamic field that allows you to switch between different measures in your visualizations without having to manually […]
On October 18 we hosted a new private event btProvider & Tableau, titled “Data & AI: Unveiling Tableau’s Magic”.
A diverging bar chart in Tableau is an efficient method for comparing two categories based on a single measure, clearly highlighting the differences. These charts are particularly useful when we want to emphasize discrepancies between two sets of data or […]