Setting label_from_parameter on dimension_group

Hello

I am trying to set up a time grain filter on my dashboard. To do so I set up a parameter such as:


parameter: select_timeframe {
label: "Select Timeframe"
type: unquoted
default_value: "month"
allowed_value: {
value: "quarter"
label: "Quarters"
}
allowed_value: {
value: "month"
label: "Months"
}
allowed_value: {
value: "week"
label: "Weeks"

And this is my dimension group:
dimension_group: case_resolution_timestamp {
group_label: "02.5 Case Resolution"
label: "Case Resolution Time"
type: time
timeframes: [
raw,
hour,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}."CASE_RESOLUTION_TIME" ;;
}

I was planning to add a case statement in the sql with the allowed_values of the parameter and label_from_parameter: select_timeframe. However, I noticed that this is not possible on dimension_group's. Any idea on how to allow my users to change time granularity without changing the current dimensions in the charts?

0 1 2,334
1 REPLY 1

Does it have to be on a dimension group?

I think you could get at this with a new dimension that references the parameter and the dimension group.

dimension: dynamic_timeframe {
  type: string
  sql: CASE WHEN {% parameter select_timeframe %} == 'month' THEN ${case_resultion_timestamp_month}
WHEN{ % parameter select_timeframe %} == 'week' THEN ${case_resultion_timestamp_week}
...
END ;;
label_from_parameter: select_timeframe
}

 

Top Labels in this Space