How to Select multiple related columns in add calculated fields in Quicksight parameter using ifelse ?

0

Hello everyone,

I have a parameter 'type' in a table and it can have multiple values as follows -

  1. human
  2. chimpanzee
  3. orangutan

I have 3 columns related to each type in the table -

  1. human_avg_height, human_avg_weight, human_avg_lifespan
  2. chimpanzee_avg_height, chimpanzee_avg_weight, chimpanzee_avg_lifespan
  3. orangutan_avg_height, orangutan_avg_weight, orangutan_avg_lifespan

So if i select the type as human, the quicksight dashboard should only display the three columns -

  1. human_avg_height, human_avg_weight, human_avg_lifespan

and should not display the following columns -

  1. chimpanzee_avg_height, chimpanzee_avg_weight, chimpanzee_avg_lifespan
  2. orangutan_avg_height, orangutan_avg_weight, orangutan_avg_lifespan

I created the parameter type and in the add calculated fields I am trying to use ifelse to select the columns based on the parameter selected as follows -

ifelse(${type}='human',{human_avg_height}, {human_avg_weight}, {human_avg_lifespan},{function})

I also tried -

ifelse(${type}='human',{{human_avg_height}, {human_avg_weight}, {human_avg_lifespan},{function}})

And -

ifelse(${type}='human',{human_avg_height, human_avg_weight, human_avg_lifespan},{function}})

But none of it is working. What am i doing wrong ?

AWS
질문됨 2년 전260회 조회
1개 답변
0

To achieve this usecase, you can use 3 calculated fields in your visual:

height

ifelse(${type}='human',{human_avg_height},
${type}='chimpanzee',{chimpanzee_avg_height},
${type}='orangutan',{orangutan_avg_height},
NULL)

weight

ifelse(${type}='human',{human_avg_weight},
${type}='chimpanzee',{chimpanzee_avg_weight},
${type}='orangutan',{orangutan_avg_weight},
NULL)

lifespan

ifelse(${type}='human',{human_avg_lifespan},
${type}='chimpanzee',{chimpanzee_avg_lifespan},
${type}='orangutan',{orangutan_avg_lifespan},
NULL)

In the visual, you can use these fields - height, weight, lifespan that would change depending on the type parameter.

Please try the above and let me know if it helps. Thank you!

AWS
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠