Executing Function Logic in Visual Titles

I am wondering if someone has any experience with executing functions in the titles of their Quicksight visuals. I am attempting to do so and am encountering a very vague error.

I have a StartDate and EndDate parameters. I want to have two visuals. I would like the first to show data between the start and end dates. For example, if the Start/End date parameters are August 1, 2022 - August 3, 2022, I would like my visual title to read “Showing Data from Aug 1, 2022 to Aug 3, 2022”.

I would like the second to show data from the same date range, but the previous year. For example if the Start/End date parameters are August 1, 2022 - August 3, 2022, I would like this visual to read “Showing Data from Aug 1, 2021 to Aug 3, 2021”.

In experimenting, I was able to prove that I am able to execute Quicksight functions in the title of a visual. For example, here I was able to run the following code using the now() and addDateTime() functions to produce a promising output


Screen Shot 2022-08-03 at 1.05.32 PM

However, there seems to be some reason I cannot run similar code while also using parameters. If I run that same code using my start date parameter I get this very vague error message:

I am hoping someone else has been down this road before and encountered this same error and can shed some light on what I’m missing.

@TheCardlessMoose, Instead of using a title you can create a custom narrative visual using the same date format function to format date parameters and overlay custom narrative visual on top of your KPI visual, something like this

This looks like it would work. Though, I guess I’m mostly just curious as to why some functions can be run inside the title of a visual while others cannot. Wondering if anyone knows the specific reason

Hi, you need to surround parameters with << and >>. These are symbols for embedding any code.
See QuickSight: How To Using Parameters to Create Dynamic Titles & Descriptions - Data - QualityNet Confluence
Also in the latest release of QuickSight , when you type <<, the user interface changes to “Embed code” . You can just enter your parameter with a $ prefix. The UI doesn’t actually show << and >> anymore.

I see that when I type in the <<>> symbol, I am able to enter the code. However, the error I described occurs when I try to run some function on those parameters (such as formatDate()).

For example, in the title:

This is fine: Data between <<${StartDateParam}>> and <<${EndDateParam}>>

This throws an error: Data between <<formatDate(${StartDateParam}, 'dd MMM yyyy')>> and <<formatDate(${EndDateParam}, 'dd MMM yyyy')>>

And the main source of my confusion is that I can execute some functions but not others. For example, this is fine as well:
Data between <<formatDate(now(), 'dd MMM yyyy')>> and <<formatDate(now(), 'dd MMM yyyy')>>