Categories
Combining 3 columns and get unique values out of it

Hi,
I am trying to combine 3 attributes named S1,S2,S3 which has the person number and then need to find unique values out of it.
Can help please help me understand how can we do this ?
For ex: if there is below values under column:
S1 S2 S3
A1 A2
A3 A1
A4 A1
so, I need to have unique values from these 3 columns i.e. A1, A2. A3, A4. This is what I'm trying to achieve.
Any suggestions on this please.
Thanks in advance.
Answers
-
Hi @Ruvina Khan have you tried creating a calculated column that concatenates the 3 original column, for exp S1||S2||S3, or S1||'-'||S2||'-'||S3. Then simply add this calculated column to a table viz and it should show you the distinct values. Is that what you meant ?
0 -
Concatenation will merge these 3 columns. But I want the repeated values to be calculated once even if the value appears in different column/row. For instance: S1: 1, S2: 2, S3: 1, so unique value will be 1 and 2 only, as 1 is repeated twice but I want it to pull once only. so, is there a way to achieve this?
0 -
You don't say "where" or "how" you would like to do that: analysis, DV workbook, semantic model/RPD, Publisher?
Keeping it simple, assuming there is a SQL source somewhere there behind, UNION is what you look for.
with t as ( select 1 a, 1 b from dual union all select 2, 1 from dual union all select 1, 3 from dual ) select a as unique_values from t union select b from t;
# result
UNIQUE_VALUES
1
2
3You need to join 3 queries for each individual column S1, S2 and S3 with a UNION (and not UNION ALL).
Can't say more on how you can practically implement it without knowing what part of the product you are asking about.
1 -
Hi Gianni Ceresa,
Thank you for the help. I missed mentioning it, I wanted to do it in DV Workbook in FDI/FAW.
Is there a way to achieve it?
0