Legend in line chart

I want to filter the data of a line chart which is having a dataset with 10 columns all plotting perfectly. As i will click on the visual legend the same visual will get filter. How to achieve this?

Hi @trideep

Welcome to Quicksight Community! Thank you for posting your question.

Could you please send any screenshot for reference?

Because I see that it filters the chart when you click on the color in legend on line chart. Just wanted to know if this is what you are referring to when you said filter visual.

LineChart-filter

Thank you,
Shravya

Thanks @shravya for the prompt reply , kindly find the screen shot… I have used line chart x axis and value with 10 column no color i have used and i do not want to use the color … is it possible ?

if you want i can send some more details to it, like a dataset is there via VPC and a view is there which i have created and used here with SPICE. Everything looks ok but while clicking on Legend the desire out put which you have shown is not coming at all

@trideep - Yeah I get it. I believe you cannot implement the way i did because i am using single column having multiple values and that is being used in the color field (something like below)

In your case, you have 10 different columns - I believe currently quicksight do not have that ability to click on the legend and filter the chart when you have multiple columns represented.

I will try to see if there is any workaround for this.

Thank you,
Shravya

ok thanks a ton , in the mean while i am trying to achieve this via control and filters

1 Like

Can you help me with this
I have put a controller


but some how it is giving me this error in calculated field as ifelse(${selectCategory} = ‘Aaro Binodon’,{Aaro Binodon},NULL)

Expression {{argumentName}} for function {{functionName}} has incorrect argument type {{incorrectArgumentType}}. Function syntax expects {{functionSignature}}.

Kindly help

Hello @trideep

Yeah so the error is saying: the types inside ifelse() don’t match. Quick Sight expects all return values in ifelse() to be of the same type.

If {Aaro Binodon} is a numeric field, make sure all return values are also numeric:

ifelse(${selectCategory} = 'Aaro Binodon', {Aaro Binodon}, 0)

Or use nullIf to return a proper numeric null:

ifelse(${selectCategory} = 'Aaro Binodon', {Aaro Binodon}, null)

So just trying to understand, you trying to show the field names in the control is it?

If you’re trying to dynamically show only one field based on the parameter, you’ll need to repeat this for each field and create a calculated field like this:

ifelse(${selectCategory} = ‘Aaro Binodon’, {Aaro Binodon},
ifelse(${selectCategory} = ‘Aaro Khela’, {Aaro Khela},
ifelse(${selectCategory} = ‘Aaro Khobor’, {Aaro Khobor},
null)))

Thank you,
Shravya

1 Like

thanks i have done it like this and is working just fyi …
ifelse(

in(‘’, ${selectCategory}) OR in(‘Aaro Binodon’, ${selectCategory}),

{Aaro Binodon},

NULL

)

Screen Recording 2025-04-19 162307
ACHIEVED … JUST FYI …

1 Like

@trideep Awesome.

If one of the solutions or idea that helped you could you please mark it as solution so that it will be helpful for others.

Thank you,
Shravya