I am using PowerBI desktop to create visualization from data source (a table in excel sheet) and I need to create a calculated field from one of the columns from the data. One of the columns in my data table is as follows:
Technology |
---|
A |
A;A |
B;B;B |
C;D;C |
A;A;B |
B;B;B |
D;D |
A; |
; |
;; |
I want to create a new column of type Boolean that outputs 1 when only one unique item is in a row of column and 0 when items in the semi-colon separated list are not unique. Like this:
Technology | New Column |
---|---|
A | 1 |
A;A | 1 |
B;B;B | 1 |
C;D;C | 0 |
A;A;B | 0 |
B;D;B | 0 |
D;D | 1 |
A; | 1 |
; | 0 |
;; | 0 |
How can I do this in PowerBI desktop?
EDIT: Updated requirements to test three more cases. (last three rows)
Add a new column and type in the following:
if List.Count( List.RemoveItems( List.Distinct( Text.Split([Technology],";")), {""})) = 1 then 1 else 0