How to Filter Calculated Field Visuals Using Parameters Linked to a String Column?

Hello QuickSight Community,

I’m currently working on a dashboard where I need to analyse data by shop_id. The shop_id column in my dataset is of string datatype, which is necessary for enforcing Row-Level Security (RLS).

To perform analysis on shop_id, I’ve created a calculated field using parseInt({shop_id}) called shop_id_int to convert it to an integer. This integer field is then used to link a filter to a ShopID parameter, which in turn is linked to the original shop_id column. This setup allows the visuals based on shop_id_int to be filtered by the selected Shop ID.

While this workaround works, it raises a question:

Is there a way to directly filter these calculated field visuals using parameters linked to the original shop_id string column?

The reason I ask is that I want to avoid duplicating and converting the column if possible. Directly filtering by the string column would simplify the process and maintain consistency across the dashboards that use this dataset.

Any insights, suggestions, or best practices for handling this scenario would be greatly appreciated!

Thank you in advance for your help! :smile:

Hi @esther_a

I am not sure why you ended up creating the shop_id_int calculated field. You could simply create a Parameter based on the original shop_id column and then filter the visuals on shop_id column linked to your parameter.

It should just work; unless there is some nuance in your case that I am unable to see.

Hi @Giridhar.Prabhu
I did this initially but whenever I clicked a Shop ID from the drop down list I received an unhelpful filter error for the visuals with calculated fields that the Shop ID filter was applied to, it doesn’t work, which is why I am here asking why. The visuals returning the error are supposed to display a calculated field with this formula: sum(hours)/distinctcount(id)

Thanks

Hi @esther_a

The formula still does not seem like should cause a problem. Can you share the error message that you get?

Regards,
Giri

Hi @Giridhar.Prabhu, here it is
Screenshot 2024-08-29 100602

Hi @esther_a

I tried to simulate the issue by creating a sample dataset as follows

I created a parameter on Shop Id (String column); Create the measure as follows

image

I added this measure to a visualization and applied the filter on shop id
image

When I filter the visualization it just works fine
image

It appears there is something more happening in your analysis that is causing the problem. I think you should create a case for this in Arena for further analysis

You can refer to this post on how to create your case Arena

2 Likes

Ah, so the calculated field in your simulation includes the field that it’s being filtered by, in my analysis the ‘id’ ← in the formula ‘sum(hours)/distinct_count(id)’, refers to another column that isn’t ‘shop_id’ and is of an integer data type

Were you able to upload your case to Arena? If you have I can take a look at the issue.