Help with the calculated field

I wanted to have a parameter at the same time works as a filter. For ex. I wanted to select Zone 1, it should display mgr1 and mgr2. I created a calculated field based on my research but it’s giving an error

‘Expression contains(‘Mgr1’,‘Mgr2’, {manager_login_lvl_2}) for function contains has incorrect argument type contains(String, String, String). Function syntax expects String, String
String, String, Boolean
String, String, StringComparisonMode.’

ifelse(
${Zonemanager} = ‘Zone 1’,
contains(‘Mgr1’,‘Mgr2’, ${manager_login_lvl_2}),
ifelse(
${Zonemanager} = ‘Zone 2’,
contains(‘Mgr3’,‘Mgr4’,‘Mgr5’, ${manager_login_lvl_2}),
ifelse(
${Zonemanager} = ‘Zone 3’,
contains(‘Mgr6’,‘Mgr7’,‘Mgr9’, ${manager_login_lvl_2}),
true
)
)
)

Hi @lgumera,

Please check the contains, it should have only 2 arguments. You can see some examples in the documentation.

Hope this helps.

1 Like

Hi @lgumera
what is the value of ${manager_login_lvl_2}?
For my the syntax logs strange.

contains(expression,substring,string-comparison-mode)
or
contains(field/string,searchstring,string-comparison-mode)

You are checking if “Mgr2” is in “Mgr1”.

BR

1 Like

I’m a newbie and appreciate the help.

Sorry, I’m also confused as I’m not an expert to quicksight but what I want to do is basically display the value of managers (mgr1, mgr2) from manager_login_lvl_2 field if a zone is selected in this case Zone 1. Not sure if I’m making sense. Thank you

HI @lgumera
so the parameter ${Zonemanager} contains Zone1, 2 and 3. Right?
what is the value of the parameter ${manager_login_lvl_2} or should it be a field?

Maybe it will help if you can show some sample data.

BR

1 Like

@ErikG Zonemanager contains, Zone 1-3. manager_login_lvl_2 is actually a field that contains all the managers. Please see screenshot. The OM column is the manager (manager_login_lvl_2). If I wanted to filter using parameter by Zone, I wanted to only show the managers that belongs to Zone 2 for the below example. Is this possible?

1 Like

Hi @lgumera,
It’s been awhile since last communication on this thread; did you have any additional questions or were you able to find a work around for your case?

In regards to limiting your visual to only return zone 2, have you tried setting up a filter for the parameter that only returns zone 2?

Let us know if you have any additional questions, otherwise, if we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @lgumera

Create a Parameter (sample below …you can create it as Zone)

Add a Parameter Control to the sheet…here you link the parameter to a dataset field and in your case it should be the zone field.

Now, filter your visual where you filter the zone field with the Zone parameter. My example below uses Region and I filter by region.

As you changes your selections in the parameter the visual responds.

I guess this is what you want right?

1 Like

Hi @lgumera,
Since we haven’t heard back from you in a while, I’ll close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this post for relevant information if needed.

Thank you!