How to setup a filter using values from multiple fields

Hi there,

I am trying to setup a filter which should allow me to select multiple values as shown below.

And these values are coming from different fields

Is there a way, I can setup a filter where I can select as many devices?

I did try to create a single field having comma (or pipe) separated values like ‘smartphone|laptop’ or ‘smartphone|tablet|desktop’ and created a parameter with multiple values and when connecting this parameter with calculated field, it is restricting to use ‘contains’ rather I could only use ‘equals’ for multiple values parameter.

Any help will be greatly appreciated.

Hi @jitendral.yadav,

A quick heads up when creating a post in the community; if you need to include any additional notes or screenshots once you’ve made an initial post, I would suggest editing your initial post instead of replying. That way, your original post will still fall in the ‘Unanswered’ section and does not have the possibility of being missed. Since when you add a second comment, it shows as though your post has been replied to.

Regarding the scenario; so are you trying to setup so that based on your parameter selection, it will show or hide the columns for each option (smartphone, tablet, laptop, etc)?

If that’s the case, then unfortunately, even if multi-select parameters were compatible with ‘contains’ or other argument types, having your data setup in this demeanor would not allow you to setup like this.
The main reason for this is that to create a new or additional column, you need to account for column using a field. Currently in Quick Sight, there is no option that allows you to use different ‘if’ clauses to fill out more than one column. Each column requires it’s own field or it will not be created.

You could create a calculated field that essentially condenses the count down to 1 column, but unfortunately, you can’t turn on/off columns based on a parameter selection. These would need to be setup as rows instead of columns in you database

Hi @Brett ,

Thanks for heads up. It is noted.

As you can see I have a column for each device type owned and would like to add a filter control that has the list of devices and user should be able to filter based on different combination of devices.

I tried creating unpivot dataset with each device as row but in that case when select device from this filter along with other filters , it filters out everything.

Hi @jitendral.yadav

You may be able to achieve this using a calculated field approach.

  1. OwnedDevices parameter control. This is something you have already created … a multi-value parameter
  2. For each of your device fields create a Selected flag calculated field as follows. The IN(NULL …) handles the case where you have Select All selected in the parameter.

Laptop Selected Flag
ifelse(contains(${OwnedDevices}, ‘Laptop’) OR IN(NULL,${OwnedDevices}), 1, 0)

Smartphone Selected Flag
ifelse(contains(${OwnedDevices}, ‘Smart Phone’) OR IN(NULL,${OwnedDevices}), 1, 0)

  1. Additional calculated field which combines all the Selected Flag calculated fields to give you a boolean result that you can use the filter the visual

Owned Devices Filter
ifelse({Laptop Selected Flag} = 1,
1, ifelse({Smartphone Selected Flag} = 1, 1, 0)
)

  1. On your visual add a filter on the Owned Devices calculated field where value equals 1

Regards,
Giri

1 Like