jeudi 1 octobre 2020

Creating Calculated column using IF statement needs to use same Source column value for multiple list options in the Calculated column

I have a client requirement where i need to create filter bins for existing column filter.

Since i cannot put the actual file here i am recreating the scenario in a dummy dxp file.

I used Tableau version 10.4

Existing column contains values A,B,C,D,E

In the calculated column i create i need to display two list items AB & AX

Basically AB - A,B and AX - A,C,D,E

I tried using if Statement and in the result, A is not displayed in the second list item of the Calculated column .

Below is the code i used:

If [Col 1]='A' OR [Col 1]='B'

THEN 'AB'

ELSEIF [Col 1]='A' OR [Col 1]='C' OR [Col 1]='D'OR [Col 1]='E'

THEN 'AC'

ELSE 'NA'

END

Expected Solution : Basically the solution i want is when i select Col 1 value 'A' both values of Calculated Column 'AB' & 'AX' should be shown and vice versa when any of the calculated column values are selected 'A' of Col 1 should be displayed as its common for both

Link with Question and Tableau File in Tableau Community : https://community.tableau.com/s/question/0D54T00000KfccNSAR/creating-calculated-column-using-if-statement-needs-to-use-same-source-column-value-for-multiple-list-options-in-the-calculated-column

Aucun commentaire:

Enregistrer un commentaire