I have a dashboard with parameters and calculated field that makes it to be able to aggregated to daily/weekly/monthly/quarterly level, here is the calculated field
Time Granularity =
ifelse(
${TimeGranularity} = ‘Daily’,truncDate(‘DD’, {reporting_period}),
${TimeGranularity} = ‘WBR’, truncDate(‘WK’, {reporting_period}),
${TimeGranularity} = ‘MBR’, truncDate(‘MM’, {reporting_period}),
${TimeGranularity} = ‘QBR’, truncDate(‘Q’, {reporting_period}),
{reporting_period}
)
Buw now I want the Quarterly level (QBR) to have something like “Q3 2025” instead of a start date of a quarter, I tried using the custom dates feature on quicksight, but since I am changing the custom field of Time Granularity(the calculated field), all levels will change accordingly.
I also tried to just create a calculated field for quarter,
quarter =
concat(
toString(extract(“YYYY”, {reporting_period})),
" Q",
toString(ceil(extract(“MM”, {reporting_period}) / 3))
)
But when I tried to put this thing into the Time Granularity calculated field like this:
ifelse(
${TimeGranularity} = ‘Daily’,truncDate(‘DD’, {reporting_period}),
${TimeGranularity} = ‘WBR’, truncDate(‘WK’, {reporting_period}),
${TimeGranularity} = ‘MBR’, truncDate(‘MM’, {reporting_period}),
${TimeGranularity} = ‘QBR’, {Quarter},
{reporting_period}
)
It also gives me an error, I am assuming this is because the data type is different from each level.
I also tried to convert all level to string but still didn’t work.
Any suggestions?