0

DatePicker

Hey,

We are working on a date filter in one of our klips but don't get it to work. We have a dataset with a date feature of the format '14-May-2021'. We want a dropdown field at the top of the klip where the user can select: last week, last month or last year. All the tables in the klip will then only show the items of the last week, month or year, depending on the choice of the dropdown field.

We already tried making multiple instances of each table where each table has a different time filter. However, it appeared to be impossible to hide the tables that were not selected by the dropdown. Also, we tried adding the following code to the dropdown:

SWITCH($daterange, 0, SELECT(4ab556a3b1028e1ee86a740b7c584b07@A2:A9999;, DATEVALUE(DATERANGE(DATE_STARTOF( TODAY(), "3" ), DATE_ENDOF( TODAY(), "3" )), "dd-MMMM-yyyy")),
1, SELECT(4ab556a3b1028e1ee86a740b7c584b07@A2:A9999;, DATEVALUE(DATERANGE(DATE_STARTOF( TODAY(), "3", -1 ), DATE_ENDOF( TODAY(), "3", -1 )), "dd-MMMM-yyyy")),
2, SELECT(4ab556a3b1028e1ee86a740b7c584b07@A2:A9999;, DATEVALUE(DATERANGE(DATE_STARTOF( TODAY(), "1" ), DATE_ENDOF( TODAY(), "1" )), "dd-MMMM-yyyy")),
3, SELECT(4ab556a3b1028e1ee86a740b7c584b07@A2:A9999;, DATEVALUE(DATERANGE(DATE_STARTOF( TODAY(), "1", -1 ), DATE_ENDOF( TODAY(), "1", -1 )), "dd-MMMM-yyyy")),
4, SELECT(4ab556a3b1028e1ee86a740b7c584b07@A2:A9999;, DATEVALUE(DATE( 4ab556a3b1028e1ee86a740b7c584b07@A2:A9999;, "dd-MMMM-yyyy"), "dd-MMMM-yyyy"))
)

Unfortunately, adding this snippet to the dropdown does not gave it the ability to filter the data. We are out of ideas at the moment and wondering if someone has the solution to our problem or a good example of how to add a date filter to a klip.

Thanks!

1 comment

  • Avatar
    Parker Selman Official comment

    Hi! 

    Thanks for the post! 

    You're correct that you cannot hide tables given certain conditions, tables are either visible or hidden and cannot be dynamically switched between. 

    However, you should be able to get one working table that filters based on your input to display the data properly. The steps listed in this article should help getting a SWITCH statement set up that will accommodate your user input control. Note that you'll likely need one start and end value, which would require two SWITCH statements as specified in the linked article.

    Hope this helps! If you require further support on this, please reach out to our team via a support ticket here!

    Best,

    Parker

Please sign in to leave a comment.