Hi,
I need some help creating a filter. Below is a simple table of date/times. I want to be able filter this table by different groups of times. For example, Group A is 8am to 12pm. Group B is 12pm to 5pm. And Group C is 5pm to 8pm.
I want a filter control that has 3 choices. Group A, Group B, Group C and it will filter down the data based on the definition of those groups above.
How would I go about doing this?
Thanks,
~Corey
Hey @CoreyLeichty !
Is this field already saved as datetime
type? If yes, you can create a calculated field:
ifelse(extract('HH', date_field) >= 8 AND extract('HH', date_field) < 12, 'Group A',
extract('HH', date_field) >= 12 AND extract('HH', date_field) < 17, 'Group B',
'Group C')
For example, I created one, and named it groups
. After, create a new filter for groups
, and add it as a control, like in the gif below.

2 Likes
@afalcao thanks for your help on this! I am using your suggestion but now need to complicate it further and need some additional help.
I believe I need to be able to use this calculated field and filter with a parameter. This is because I need to be able to pass this parameter to a different widget that acts a drilldown for the chart I am building. So the user may filter by one or more of these time groups on a chart, then they click a bar to drill into a table of information that represents that bar.
The group choices are multi select so it is a multi value parameter. I am trying to do the following but get an error because of the string vs array comparison.
Is anyone able to help with this question/issue?
Hi @CoreyLeichty
You need to use the IN function …ifelse(IN(“Session 1”, ${psessions}, True Case, False Case)
Regards,
Giri
Hi @Giridhar.Prabhu,
Thanks for your response. That helps but I’m still having issues. So to keep it simple I’m just keeping it to one check for one of the sessions that way it doesn’t get too complicated with nested checks at this point.
This is what I have for my calculated field called Sessions Filter.
ifelse(IN(‘Session 3’, ${psessions}), ifelse(extract(‘HH’, Date) >= 17 AND extract(‘HH’, Date) <= 20, ‘Selected’, ‘Exclude’), ‘Exclude’)
I still have the psessions multi value string parameter and I have a multi select dropdown control on the sheet connected to this parameter. This sheet control gives the following error:
And here is how I am using the Sessions Filter as a filter for a chart visual.