Help with creating a filter

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.
ScreenRecording2025-01-31at18.53.32-ezgif.com-video-to-gif-converter

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.

Does anyone have any other ideas/help for this issue? I’m still stuck on this…

Hi @CoreyLeichty

In your error message it says “Following items are incompatible”. Can you share the complete error message so we can see what incompatibility it is talking about?

May be we could see if there is a way the calculated field can be changed to resolve the issue.

I saw an old post with a similar issue; but there was no specific resolution

Regards,
Giri

Sorry about that @Giridhar.Prabhu! I didn’t include the full error. Here is what it is saying:

Does anyone have any additional help they can provide for this?

Hi @CoreyLeichty,
Take a look at the Arena view I created, is this more of what you’re looking for?

Help with creaating a filter

Hi @CoreyLeichty,
It’s been awhile since we last heard from you on this thread, did the Arena view I provided in the last response help with your case?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @CoreyLeichty,
Since we have not heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community.

Thank you!