I’m trying to follow this example in the demo site:
I have a parameter dropdown control with a list of values and I’d like to control the date grouping in my chart based on the selection. My calculated field looks like this:
ifelse(
${DateRangeParm}=‘Last Month’,truncDate(“MM”,Date),
${DateRangeParm}=‘Last 3 Months’,truncDate(“MM”,Date),
${DateRangeParm}=‘Last 6 Months’,truncDate(“MM”,Date),
${DateRangeParm}=‘Last Year’,truncDate(“MM”,Date),
${DateRangeParm}=‘Last 4 Quarters’,truncDate(“Q”,Date),
${DateRangeParm}=‘Year’,truncDate(“YYYY”,Date),
truncDate(“MM”,Date)
)
While this does work, I can’t figure out how to format the data on my x-axis based on the DateRangeParm. If it’s one of the monthly formats, I want it formatted “Jan 21”. If it’s quarterly, I would like “Q1 21”, and yearly should be “2021”.
This is what it looks like when I select “Last 6 Months”

Here is “Last 4 Quarters”

I tried doing a dateFormat around the truncDate functions but that gives me an error.

