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年前338ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ