Filters for line chart

Hello community,

I have the below data. I am have created a visual like this.

I am trying to add a filter where I can have a dropdown or a text field to add a specific OPT number to visualize just that OPT. I am not able to add a filter to the column names (OPT numbers are column names in my data). How can I achieve this? Any help is appreciated.

Many thanks,
TK

OPT1 OPT2 OPT3
2024-02-04 15:00:00+00:00 1 1
2024-02-04 16:00:00+00:00 1 1
2024-02-04 17:00:00+00:00 1 1
2024-02-04 18:00:00+00:00 1 1
2024-02-04 19:00:00+00:00 1 1 1
2024-02-04 20:00:00+00:00 1 1 1
2024-02-04 21:00:00+00:00 1 1 1
2024-02-04 22:00:00+00:00 1 0 1
2024-02-04 23:00:00+00:00 1 0 1
2024-02-05 00:00:00+00:00 1 0 1
2024-02-05 01:00:00+00:00 1 0 1
2024-02-05 02:00:00+00:00 1 1 0
2024-02-05 03:00:00+00:00 1 1 0
2024-02-05 04:00:00+00:00 1 0 0
2024-02-05 05:00:00+00:00 0 0 0
2024-02-05 06:00:00+00:00 0 0 0
2024-02-05 07:00:00+00:00 0 0 0
2024-02-05 08:00:00+00:00 0 0 0
2024-02-05 09:00:00+00:00 0 0 0
2024-02-05 10:00:00+00:00 0 0 0
2024-02-05 11:00:00+00:00 0 1 0
2024-02-05 12:00:00+00:00 0 1 1
2024-02-05 13:00:00+00:00 0 1 1
2024-02-05 14:00:00+00:00 0 1 1
2024-02-05 15:00:00+00:00 0 1 1
2024-02-05 16:00:00+00:00 1 1 0
2024-02-05 17:00:00+00:00 1 1 0
2024-02-05 18:00:00+00:00 0 1 0

Hi @TK2895 ,

For this filtering, we would need to create a parameter followed by a calculated field and use that instead of all 3 fields in the line chart.
Below is a step by step details:

  1. create a parameter with single select text type with default value set to either of the values
  2. Add a control of the parameter with the dropdown config and specify the values you are planning , e.g. opt1, opt2, opt3
  3. create a calculated field to create the Y axis field .
    ifelse($parameter=‘opt1’, {opt1},$parameter=‘opt2’,{opt2},{opt3})
  4. Use this measure in the Y axis replacing the 3 separate fields.

Thanks.