Use values selected in Multi Value Parameters in Calculated Field

Hi,

I have a multi value parameter “Category” linked to backend column cat. By default, all values of column cat are selected for this control. I have another parameter “Data Granularity” which is linked to field data_grain in my dataset. I want to achieve below:

  • When all values (by default) of Category are selected then data_grain should pick up value V1
  • When a user selects one or more values in control Category then data_grain should pick up value V2 from dataset.

Problem I am running into is that as soon as I use a Multi Value parameter in my calculated field, Quicksight throws a syntax error.

Screenshot 2024-05-13 at 1.42.42 PM

3 Likes

Hello @NeerajGautam, if you want to use the Multi Value parameter in a calculated field, you need to do one of two things. First, you need to make sure your static default value is set for the parameter. You can use ALL_VALUES to make sure it will display select all. Then you can use the in() calculation to check for these expectations. I’ll write an example of the calculation below:

ifelse(
in(NULL, ${Category}) AND {data_grain} = 'V1', {data_grain},
{data_grain} = 'V2' AND in(NULL, ${Category}) = FALSE, {data_grain},
NULL
)

Please note that I am checking if the ${Category} parameter contains NULL because that is how you can check for the default select all value in a calculated field. Let me know if this helps!

2 Likes

Hi @NeerajGautam, did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community!

Yes, the idea worked. I had to create two level of calculated fields, then compare the calculated value with one of the column’s value to produce a TRUE/False output and then select only those values where the final output is TRUE

Hi Dylan,

Thank you for guiding me in the right direction. This idea works.

2 Likes