Year-to-year comparisons with dynamic temporal grouping

Hi all. As you can see in the image, I need to develop reports like this one where I have a date dimension (DATALIQPH) and a measure (IMPORTPH). I need to dynamically group the information (monthly, quarterly, yearly, etc.) for the selected year and compare it with the previous year or with the 2nd, 3rd, … years before. I have tried different solutions posted inside the community without success. Can anyone help me?

Hello @jcrodriguez , welcome to the Quicksight community!

Do you want to be able to do this all within the same table? If so you may be able to achieve this with filter if all of the data in DATALIQPH is formatted the same way. i.e “2022-abr”

What you could try if the other solutions don’t work is create a the following parameters with controls set up for specific values that you designate:
Period = Month, Quarter, and Year
Month = List Months
Offset Slide = However many years increments you want to go back

I suggest following the steps explained here:

For you months parameter, you will need to create a new calculated field that says something like this:

ifelse(
${Months} = "January" AND contains({DATALIQPH}, "jan"), {DATALIQPH},
${Months} = "February" AND contains({DATALIQPH}, "feb"), {DATALIQPH},
etc...., 
NULL)

Let me know if this helps!

Thank you. The article shows me how to do it. Many thanks.

1 Like

@jcrodriguez No problem!