Single visual with different time period aggregation

Hello,
Is there a way to combine the following 3 visuals (spend by month, spend by week, spend by day) into a single visual and allow dashboard viewer/reader to choose the time period from the dashboard? The visual could show spend by month, spend by week, spend by day in a drop down and allow the user to select the time period from the dashboard itself.

You need to create a single value string parameter called ${aggregation} with the following possible values:

DAY
WEEK
MONTH

Assuming your date field is called {date}, then you could use the following calulcated field in the x-axis of your visual

ifelse(
  $aggregation = 'DAY', truncDate('DD', {date}),
  $aggregation = 'WEEK', truncDate('WK', {date}),
  truncDate('MM', {date})
)

Thank @darcoli
Based on your pointers, got the aggregation implemented and linked to a control with dropdown values MONTH, WEEK, and DAY as follows. Now, I have challenge positioning the control in a single visual as the filter is applied only to a single visual in my dashboard. Following are the 3 layouts I can come up with, none of these appears very intuitive for the users. Any pointers to make the control placement.

  1. Classic layout - Dropdown control above the visual
  1. Free-form layout - Dropdown control overlapping the title of the visual
  1. Free-form layout - Dropdown control placed as label for X-axis.

Usually I use a separate tab for such cases to avoid ambiguity. But from your options, I prefer the second one :wink:

One issue I’m encountering with the Month/Week/Day dropdown control placement (shown below) gets displaced on a smaller screen when the responsive rendering kicks-in when I go from two column/side-by-side layout to single column layout. We need some mechanism to pin the control location onto the visual under it.