Combine columns in Power BI without duplicates

Let's assume that you have the following data in Power BI:

ascii
|   Column.1   |   Column.2   |   Column.3   |
=============================================
|      A       |      A       |      C       |
|      B       |      A       |      C       |
|      C       |      B       |      A       |
|      B       |      B       |     (null)   |
|      A       |      A       |      C       |
=============================================

If you combine the columns, removing duplicates for each row, you'll obtain the following result:

ascii
|   Result      |
================
|      AC       |
|      ABC      |
|      ABC      |
|      B        |
|      AC       |
================

Go to the Power Query Editor in Power BI, and then create a custom column. In this case, the name would be 'Result', and the custom formula:

PowerQueryM
Text.Combine(
    List.Sort(
        List.Distinct({
            [Column.1], 
            [Column.2], 
            [Column.3]
    }))
, "")

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.