Search code examples
powerbidaxpowerpivot

Concatenate values except when equal to string


Please some help. With this DAX formula I concatenate all unique values of Column3

Column4 = CONCATENATEX(
VALUES(Table1[Column3]),Table1[Column3],", ")

with result

ABC,DEF,WXYZ,HHT

My issue is that I would like to concatenate all unique values, except the value "WXYZ"

I've tried this:

Column4 = CALCULATE(
        CONCATENATEX(
 VALUES(Table1[Column3]),Table1[Column3],", "),
       FILTER ( Table1, 
FIND( "WXYZ", Table1[Column3],, 0 ) = 0 )
)

But I get circular dependency was detected: Table1[Column4]


Solution

  • I think the solution would be something the following - filter the table first and then concatenate:

    CONCATENATEX
        (
            DISTINCT(FILTER(Table1,Table1[Column3] <> "WXYZ"))
            ,Table1[Column3]
            ,", "
        )