Update Calendar Range dates using button with filter interaction

I have a dashboard with a Calendar Range to allow users to filter elements to any date desired. I also have 3 buttons with date filter interactions. One is a Month-to-Date filter button, another a Quarter-to-Date filter, and the 3rd is a Year-To-Date filter.

I am trying to “connect” each button to the Calendar Range so that if a user opts to filter the dashboard using one of the buttons the Calendar Range dates display match the date perspective of the button pushed. Is there a setting or script I can apply?

For example if the Calendar Range is showing 4/15/2021 in the FROM field and 6/15/2021 in the TO and then the Year-to-Date button is pushed, then displyed dates in the Calendar Range will show 1/1/2021 and 8/20/2021

1 Like

Hey Everardo, I see you’re new - welcome to the party!

I learned this kind of functionality just a few months ago, so it’s still fresh in my mind. To be sure of what you’re asking, though, can you take a look at this and see if it is similar? This one doesn’t show the date filter, but it manipulates it in the background so the idea is the same, I believe:

https://www.dundas.com/support/developer/script-library/filter-and-parameter/set-date-time-range-parameter

If so, the script can give you an idea of how it works.

Hi Everardo,

If I understand your scenario correctly, this should be possible without script. If the buttons are setting the same view parameter that the Calendar Range filter is connected to, the filter should update automatically when the button is clicked, including when setting it to a token like “year to date”. When I try this, the corresponding from & to dates are filled in for the calendar range filter like you described.

This article shows the easiest way to set up a button (or any other component) to set a parameter to some predefined value like this: https://www.dundas.com/support/learning/documentation/design-view/interactions/use-a-button-to-apply-a-filter-value

If you already have a calendar range filter connected to your data, you can skip to section 4 and choose this view parameter in the dropdown when setting up the filter interaction. You can confirm which view parameter a filter is using by opening its Connect Filters popup and switching to the Parameters tab. (https://www.dundas.com/support/learning/documentation/create-view-content/filters/adding-filters#h6-parameters)

1 Like

@jamie.cherwonka @ken
Thank you both. Jamie your solution worked but we ended up removing the the button filters altogether to simply the dashboard. Thank you for your time