Dashboard - change date type in elements with a filter



Is it possible to create a filter with the options Daily, Weekly and Monthly such that, when selecting one of those, the time base of the dashboard elements changes?


(Nicole Beyer) #2

Hey @ppuerta!

This isn’t currently possible but I have passed the idea along to product for consideration!

(Ophir Moser) #3


Is there a way to do this now?


(Izzy) #4

@Ophir_Moser , there’s still no built in one-click functionality to do this, but I had a nifty idea of a way to do this fairly simply using parameters. There’s an article on discourse about using parameters to accomplish a dynamically changing timezone dimension (shout out to @clrcrl!!) and I think you could leverage exactly the same logic here in a slightly tweaked way.

If you have a dimension group on your date field (lets call it dimensiongroup), then you can simply create a parameter (per that other article) called “Time Base” and give it the options Daily, Weekly, Monthly, and then build a dimension that basically says

dimension: timebasefordashboard {
type: string
   {% if parameters.timebase._parameter_value == "'Daily'" %}
   {% elsif parameters.timebase._parameter_value == "'Weekly'" %}
   {% elsif parameters.timebase._parameter_value == "'Monthly'" %}
   {% else %}
   {% endif %} ;;

If you use that timebasefordashboard dimension as the x-axis for your charts etc, and add a dashboard filter (making sure to apply it to all the tiles), you should be able to dynamically change the time metric.

Make sure to use type: string here instead of type: date, because otherwise the SQL may choke if it’s expecting a date and instead, since you’ve selected “Monthly”, it returns a month name.

Can anyone else think of a neat way to do this? I could be overcomplicating things!