Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
cgkas
Helper V
Helper V

How to get unique values excluding one value - DAX formula?

Hello to all,
 

With the following DAX formula I concatenate all unique values of Column3

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

with result

ABC,DEF,WXYZ,HHT

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: 

 

My expected output would be:

ABC,DEF,HHT

 

UPDATE

Below from ID to Column3 is my input table and I'd like to get the unique values (excluding "NOT AVAILABLE") in Column4 for each ID(0,1,2,3) and each value in Column2 (A and B). So in Column4 (output column) would look like this:

 

IDColumn1Column2Column3Column4
051234BNOT AVAILABLEKTGGTG
177567AHWUSHWUS,TKYHNY
2123149674AHCGUSGHCGUSG,TKYHNY
214047259AHCGUSGHCGUSG,TKYHNY
371369756ARCNGBNRCNGBN
0502609BKTGGTGKTGGTG
01312314AHCGUSGHCGUSG
1775ATKYHNYHWUS,TKYHNY
2775ATKYHNYHCGUSG,TKYHNY
31989707BUT1TY1HWUS,KTGGTG,UT1TY1
3532715ARCNGBNRCNGBN
3502991BKTGGTGHWUS,KTGGTG,UT1TY1
3120631BHWUSHWUS,KTGGTG,UT1TY1
31320334BNOT AVAILABLEHWUS,KTGGTG,UT1TY1
331234BUT1TY1HWUS,KTGGTG,UT1TY1
347259BKTGGTGHWUS,KTGGTG,UT1TY1

 

Thanks in advance for any help.

1 ACCEPTED SOLUTION

@cgkas -

Here's the best I could come up with:

Create a table as:

Table = 
SUMMARIZE (
    Table1,
    Table1[ID],
    Table1[Column2],
    "temp", CONCATENATEX (
        FILTER (
            DISTINCT(Table1[Column3]),
            FIND (
                "NOT AVAILABLE",
                Table1[Column3],
                ,
                0
            ) = 0
        ),
        Table1[Column3],
        ", "
    )
)

Column4 as:

Column4 = 
LOOKUPVALUE(
    'Table'[temp],
    'Table'[ID],Table1[ID],
    'Table'[Column2],Table1[Column2]
)

Produces:

5.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

9 REPLIES 9
ChrisMendoza
Resident Rockstar
Resident Rockstar

@cgkas -

This seems to work:

Column5 =
VAR _filter =
    FILTER (
        Table1,
        FIND (
            "WXYZ",
            Table1[Column3],
            ,
            0
        ) = 0
    )
RETURN
    CONCATENATEX (
        _filter,
        Table1[Column3],
        ", "
    )





Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Hello ChrisMendoza, Thanks for your help. I'm receiving as output all values, not only unique ones. I'm testing in DAX Studio in Excel 2016.

@cgkas -

I presumed your sample table looked like the below, is that not the case?:

4.png

Please provide an accurate sample.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!




@ChrisMendoza wrote:

@cgkas -

I presumed your sample table looked like the below, is that not the case?:

4.png

Please provide an accurate sample.



@ChrisMendoza wrote:

@cgkas -

I presumed your sample table looked like the below, is that not the case?:

4.png

Please provide an accurate sample.


Hi @ChrisMendoza

 

I've updated my original post showing a sample table and output.

 

Thanks for the help.




@cgkas -

Here's the best I could come up with:

Create a table as:

Table = 
SUMMARIZE (
    Table1,
    Table1[ID],
    Table1[Column2],
    "temp", CONCATENATEX (
        FILTER (
            DISTINCT(Table1[Column3]),
            FIND (
                "NOT AVAILABLE",
                Table1[Column3],
                ,
                0
            ) = 0
        ),
        Table1[Column3],
        ", "
    )
)

Column4 as:

Column4 = 
LOOKUPVALUE(
    'Table'[temp],
    'Table'[ID],Table1[ID],
    'Table'[Column2],Table1[Column2]
)

Produces:

5.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!




@ChrisMendoza wrote:

@cgkas -

Here's the best I could come up with:

Is the best you could do, but is the solution I was looking for heheh. Thanks so much for the help.

amitchandak
Super User
Super User

Can you filter in CONCATENATEX 

 

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

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information.
Thanks.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube


@amitchandak wrote:

 

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

 

 There's an extra comma giving you the error message.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Thanks for your help amitchandak,

 

I'm getting error "Argument 2 in CALCULATE is required"

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.