How to use a control value as a field legend name

I need that when I select the value of the control, the field that references it on my dashboard will have the name according to the selected value, so I can use it in my legend
image

image

Hi @PedroRodriguezxX,
To set this up, you’ll need to utilize parameters with your control. Then you can setup using the parameter so that it’s variable.
When you say ‘the field that references it on your dashboard’, can you share a bit more on what you mean? Where on the visual are you trying to populate the value title? Could you share a screenshot of your visual and point out what you’re trying to change and I should be able to point you on a more clear path.

Thank you!

Hi @Brett, thanks for your answer again.

I have two controls that I am using to compare performance between two different fields, I am currently using them with parameters

image

What I need is that when the control value is selected, the value automatically becomes the name of the field that will be the legend

image

1 Like

Hi @PedroRodriguezxX,
What does your ‘color by’ field look like? Is it a calculated field? That is what is populating the legend, so you could alter the calculation to return the value of the parameter selection.

Instead of returning string values Field 1 and Field 2, return ${Parameter} else Field 1.
Something along those lines.

Let me know if this works for your case or if I can assist with any further questions!

Hi brett, this does not worked for me. I seted a default value to allow me use the parameter in the calculated field, but this don t bring me the parameter name like the selected in the control

image

Hi @PedroRodriguezxX,
Can you please share the calculated field that you’re using?

Thank you!

1 Like

sorry, is not a calculated field. I just create the calculated field to allow me rename the field

Hello @PedroRodriguezxX, it looks like the parameter was not entered into the calculated field quite right. Something you can do as well, rather than using the default parameter value to display, but you could display the original field you were using in the field well if the default value hasn’t been updated. Your color by field would look something like this:

ifelse(${Parameter} = 'Default Name', {field from dataset}, ${Parameter})

You can reference the parameter properly in a calculated field if you open the dropdown menu and double click the parameter you want.

image

I had to blur out the parameters, but if you double click one in the calculated field, it will populate. You can then replace the current field in your color by with this new calculated field. That will return the original value or the parameter value after a user makes a selection. Let me know if that helps!

Hi @DylanM, thanks for your time. The default value must be updated, the user who will consume the dashboard will use the reference legend

1 Like

Hello @PedroRodriguezxX, how do you want the default value to update? I am unable to assist without more information about exactly what you are wanting the desired result to look like.

How do you want the legend to be named on load? Is the default going to be different depending on the user that is viewing the dashboard?

What do you want to happen when one of the 2 dropdown controls is changed? Should the legend return the exact same name? What do the controls display on default when the user loads into the dashboard? What happens if both of the control dropdowns are changed by the user?

If you are able to provide more information about the functionality that you want in the dashboard, then @Brett and I should be able to guide you towards a solution. It would also be beneficial if you could create a demo version of the dashboard in QuickSight Arena and share it with us. That would make it easier to test out possible solutions in an Analysis environment and share the results with you directly.

Thank you!

I want that when I change the value in the control, the same value change the name of the legend field

1 Like

Hello @PedroRodriguezxX, if you just want the legend value to match the selection made in the control dropdown, then you can return just the parameter value in a calculated field and use that as the color by field well.

Alternatively, if one grouping is one parameter value, and the second grouping is the other parameter value, than you can use conditional logic to return one or the other.

ifelse({field} = 'field 1', ${FirstParam}, ${SecondParam}) and that would create your 2 groups.

I will mark this as a solution, but let me know if you have any further questions.

1 Like