This blog covers the following line-related chart types:
- Cumulative curve
- Moving Average with Parameters
- Cycle Plots
The chart above shows a cumulative chart summing up the quarterly sales by region from Superstore data from 2018 Q1 to 2021 Q4. To recreate this chart:
- You need x1 continuous date measure in 'Columns' and x1 continuous measure (e.g. Sales) in 'Rows'
- Add a table calculation to your measure in 'Rows' as shown in the image above (choose 'Sum of Running Total' in your calculation type and compute using 'Table across' - this computes across the length of the table, and then down the length of the table)
Moving Average with Parameters
The chart above shows a 6-month moving average for Superstore monthly sales. To recreate this chart:
- You need x1 continuous date measure in 'Columns' and x2 (dual-axis) continuous measures in 'Rows'.
- Create the MA parameter with a list of values (Create parameter > Select allowable values to list > list values and aliases). Do not forget to select the data type of the values.
- Create a calculated field for the MA (WINDOW_AVG(SUM([Sales]), -[Moving Avg Parameter], 0). You can play around with the [start, end] of the WINDOW_AVG calculation parameters to change the relative data used to create the moving average.
- Dual axis the calculated field with the other line chart you would like to display. Do not forget to synchronise your axis and format your chart.
The chart above shows a cycle plot for Superstore sales (and last sales dot for each cycle) from 2018 to 2021. To recreate this chart:
- You need x2 discrete date dimensions in 'Columns' and x2 (dual-axis) continuous measures in 'Rows'.
- Select your cycle periods (e.g. year and month in this case)
- Create a calculated field to find the value of the last measure per cycle ( IF LAST()=0 THEN SUM([Sales]) END - last sale in this case).
- Dual-axis this field with the aggregated measure of this field (e.g. Sum(Sales) with Last Sale). Do not forget to synchronise your axis and format your chart.