koot
August 16, 2023, 5:59am
1
How to create a chart that compares monthly year-to-year data on one graph? In the table I have daily data for several years.
+-------------+-------+
| Date | Value |
+-------------+-------+
| 01-01-2019 | 123 |
| 02-01-2019 | 321 |
| 03-01-2019 | 234 |
| 04-01-2019 | 312 |
| ... | ... |
| 01-08-2023 | 987 |
| 02-08-2023 | 654 |
+-------------+-------+
Max
August 16, 2023, 12:45pm
2
Please check out this article. It should be what you are looking for.
This article uses the SaaS-Sales Dataset that you can download as part of the QuickSight Author Workshop . We will update the data to the current date so your calculations are realistic.
If you do not have a QuickSight account please follow the instructions in the Initial Setup. Instructions to create the dataset can be found in Exercise 1 of the Build your first dashboard. Create an analysis for the dataset.
The following steps show you how to create visuals to show data from the current year,…
Hi @koot ,
In addition to Max’s suggestion, here are a couple other options:
Create calculated fields to partition the data
Create separate datasets for each year and then display the visualization for each data on top of each other (see here )
I did prototype the first option with moderate success:
The calculated fields for these are:
date_month => extract(‘MM’, {Date})
date_month_2 => formatDate({Date}, ‘MMM’)
year=2019 => ifelse(extract(‘YYYY’, Date) = 2019, Value, null)
year=2020 => ifelse(extract(‘YYYY’, Date) = 2020, Value, null)
The biggest issue you run into is that the formatDate() function returns a string, which then messes up the calendar sorting. You can use the truncDate field, but then the year is implicit and the X-axis will show more than a single year. e.g.
Let me know if this helps.
ws