KPI Error- The secondary value(comparison metric) stops displaying when I apply a date filter

Hi,
I’m facing an issue with my KPI visualization in Amazon QuickSight. The secondary value(comparison metric) stops displaying when I apply a date filter. Here’s what I have:

  • My KPI is based on total revenue of a month
  • The secondary value is supposed to show a comparison with the previous month
  • When I apply a date filter ( only the last month), the secondary value disappears, also the visualization disappeared.

Hi @Dafini,
It sounds to me like the value is not returning because the date filter is limiting the window of data to show and the previous month calculation may not be taking that in to affect.

Would you be able to share the calculated field you have setup to show the previous month comparison?

Hi @Brett, Thanks for your response, here I have attached the screenshots


Total Charge is not a calculated field, i am not using any calculated field either.

Hi @Dafini,
What if you tried building a calculated field that sums the prior month and then use that for your trend group category. It may look something like:

sum(
ifelse(
extract(“YYYY”, {label_created_at}) = extract(“YYYY”, truncDate(“MM”, now()))
and extract(“MM”, {label_created_at}) = extract(“MM”, truncDate(“MM”, now())) - 1,
{rate_total_charges},
0
)
)

Hi @Brett ,
thanks for your response, it works, but i am using the date filter as a control, so the date would be dynamic, it could be 1 month, 10 days or 1 day.

is there any way to do this? @Brett

Hi @Dafini,
Can you share what your control looks like so that I can see the options available?

Here @Brett

Hi @Dafini,
So in situations where your handling a different time gap, how are you trying to compare..so for example:
If it’s ‘10 days’, are you looking to compare against the same 10 days in the prior month? Or the 10 days before the 10 day period that you have set?
So let’s say your date range is 01/10/2025-01/20/2025. Do you want to compare against

  1. 12/10/2025 - 12/19/2025
  2. 12/31/2024 - 01/09/2025

yes, i wanna compare with 2. 12/31/2024 - 01/09/2025

@Brett, just following up to see if you had any updates for me

Hi @Dafini,
Apologies for missing your last response.
In this instance, you’ll most likely need to incorporate the addDateTime function.

What if you created a separate calc. field to find the total count of days between your parameter dates using dateDiff.

Then you can use that count to subtract from each of your date fields using addDateTime.
This should gather the correct rows to cover previous period.

Let me know if this could work for your scenario or if you have any additional questions.

Thank you!

Hi @Dafini,
Following up here as it’s been awhile since we last heard from you; did you have any additional questions regarding your initial post?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Thank you for your answer , its helpful :slightly_smiling_face:

1 Like