Visualizing seasonality and percentiles
1. Visualizing seasonality and percentiles
In this demo, we will be revisiting the Tableau superstore dataset where we'll explore the concepts of seasonality, how to identify this, and how to use percentiles to identify anomalous values. Let’s drag in our Date_Parse_Month field we created earlier, convert this granularity to a week in our Columns and then overlay our Year and Quantities against this in our Rows If we observe the data, we might see certain peaks appearing repeatedly as we look at the data over the years. We note there appears to be a gradual ramp-up of quantities throughout the year, with a repeatable decline and then a peak over the 2014 - 2017 period. In other words, there’s a clear signal for seasonal behavior. However, we want to clarify this further, so let’s add some seasonal classifications. We’ve prepared this field earlier where we’ve highlighted our seasonal sales so let’s take a quick look. We’ve used a simple IF statement to break down our months to the respective seasons of interest. Dragging the colors into our visual, we can see that the sales peak occurs over the Fall and Christmas periods. Now this can be a little tricky to see, so re-arranging our axes here with Months and Seasonality in the Columns with our Quantity in our Rows gives us a simple bar visualization that reinforces the trends we’re seeing where the behavior in fall follows the same predictable pattern. Now we are inclined to believe that fall is where the majority of our volatility is occurring, but it’s important that we’re aware that we’re looking at the aggregate quantity volumes here, which might skew our conclusions. Aggregates mean we’re summating all the values together, even those that might appear abnormal, whereas in certain cases, we might exclude these values. Now let’s clear the canvas and look at another visual using Box Plots. We’ll drag the Seasons into our Columns before dragging the Year and SUM(Quantity) into our Rows. At this point, our visual looks a little underwhelming, where we can’t see any real trends. We’re interested in understanding the monthly volatility in our seasonal analysis. Let’s add months to the details card where we see a more insightful narrative. We have two seasonal areas we should pay close attention towards; Fall and Winter, which exhibit sizeable fluctuations! Opening up a new canvas with seasonality in mind, let’s see if we can use any smoothing techniques to address this. Firstly, we’ll add in the Month and Quantity back into our visuals, but we’ll add in a table calculation to help us smooth the data. We’ll select moving average which helps us smooth out the noisiness of our data. It is important to note by default, it uses the past 2 data points. With the moving average, it’s looking much smoother now than what we had previously. The peaks are still noticeable, but the data has less peaks, so the change are easier to see. It’s also worthwhile noting that we can adjust the number of data points used in our Moving Average calculation by simply editing the table calculation. We can then adjust the number of points accordingly. Now that we’ve smoothed the data out - is there anything else we could look to do? Well, let’s imagine we’ve been asked to classify the threshold for an anomalous quantity of goods. We can do this with the PERCENTILE function here. We simply create a new calculated field and specify our percentile of interest. However, it’s important to note that we want to apply this check against all values in our set so we have to use a fixed expression here. Here we’re saying, if there are any Sales Quantity that is less than or equal to the 95th percentile, classify this as ‘Normal, otherwise ‘Anomaly’. Dragging the Quantity into our Columns and shifting this to a histogram - we can see the distribution of quantities of items sold. Adding in our category to the Rows, let’s us see the breakdown for each category, and lastly, dragging in our PERCENTILE calculation let’s us see where the majority of anomalous values are concentrated; within the Office Supplies category. Now it's over to you!2. Let's practice!
Now it’s over to you.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.