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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Saxon10
Post Prodigy
Post Prodigy

CONCATENATEX without duplication (DAX)

 

I have a two tables are data and report.

 

 

Data:

 

In Data table I have two columns are Item and supplier code, The item column and supplier code contain/stored as a number and text, both column contain duplicated/repeated.

 

Report:

 

In report table I have a unique item column (Not duplicated) . The item column contain/stored as a number and text.

 

Result:

               

I am looking for supplier code within the same column from data table into report table according to the item.

 

If item not available in data table then return “NA” in report table according to the item.

 

In both tables the item column are common.

 

Currently I am applying the following calculated column in my report table

Supplier code = CONCATENATEX(FILTER(ALL(DATA),DATA[ITEM]=EARLIER(REPORT[ITEM])),DATA[Supplier Code],",") but it will give a duplicated supplier code within the same column but I am looking for supplier code without duplication within the same column.

Power BI:

CONCORNATE.PNG

Data and Report table snapshot:

 

DTABLE.PNG

 

Any advise please.

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Saxon10 , Try new column like

 

Supplier code = CONCATENATEX(Summarize(FILTER(DATA,DATA[ITEM]=EARLIER(DATA[ITEM])),DATA[Supplier Code]),[Supplier Code],",")

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

View solution in original post

PaulDBrown
Community Champion
Community Champion

@Saxon10 

Try:

Supplier code =
VAR _table =
    CALCULATETABLE (
        VALUES ( DATA[Supplier Code] ),
        FILTER ( ALL ( DATA ), DATA[ITEM] = EARLIER ( REPORT[ITEM] ) )
    )
RETURN
    CONCATENATEX ( _table, DATA[Supplier Code], "," )




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

10 REPLIES 10
PaulDBrown
Community Champion
Community Champion

@Saxon10 

Try:

Supplier code =
VAR _table =
    CALCULATETABLE (
        VALUES ( DATA[Supplier Code] ),
        FILTER ( ALL ( DATA ), DATA[ITEM] = EARLIER ( REPORT[ITEM] ) )
    )
RETURN
    CONCATENATEX ( _table, DATA[Supplier Code], "," )




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you so much for your help. It's working fine.

I am trying to copy and paste the tables(Data&Report) here but I am receving the following error can you please advise how can I rectify the problem?

ERROR.PNG

Hi,

 

Thanks for your quick reply. Your solution working well but I would like to get NA for item 1066 and 2000 insted of blanks.

 

Saxon10
Post Prodigy
Post Prodigy

ERROR.PNG

I am trying to copy and paste the tables(Data&Report) here but I am receving the following error can you please advise how can I rectify the problem?

 

Herewith attached the Power Bi file for your reference https://www.dropbox.com/s/1qashz0f8gftip0/CONCORNATEX.pbix?dl=0

 

@Saxon10 
1) as a calculated column in the Data table

 

Supplier code Concatenate = 
VAR _table =
    CALCULATETABLE (
        VALUES ( DATA[Supplier Code] ),
        FILTER ( ALL ( DATA ), DATA[ITEM] = EARLIER ( DATA[ITEM] ) )
    )
RETURN
    CONCATENATEX ( _table, DATA[Supplier Code], "," )

 

you get:Captura.JPG

2) as a measure:

Supplier code Concatenate (as a measure) = 
CONCATENATEX ( VALUES(DATA[Supplier Code]), DATA[Supplier Code], "," )

concatenate.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thanks for your quick reply again. 

 

I try your another soultion but still I am not getting NA agaist item 1066 and 2000?

If item not available in data table then return “NA” in report table according to the item.

 

please advise. 

@Saxon10 

Try:

1) as a calculated column in the DATA table:

Supplier code Concatenate = 
VAR _table =
    CALCULATETABLE (
        VALUES ( DATA[Supplier Code] ),
        FILTER ( ALL ( DATA ), DATA[ITEM] = EARLIER ( DATA[ITEM] ) )
    )
VAR _Concat = 
    CONCATENATEX ( _table, DATA[Supplier Code], "," )
RETURN
IF(DATA[Supplier Code] = "", "NA", _Concat)

2) as a measure

Supplier code Concatenate (as a measure) =
CONCATENATEX (
    VALUES ( DATA[Supplier Code] ),
    IF ( MAX ( DATA[Supplier Code] ) = "", "NA", DATA[Supplier Code] ),
    ","
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






amitchandak
Super User
Super User

@Saxon10 , Try new column like

 

Supplier code = CONCATENATEX(Summarize(FILTER(DATA,DATA[ITEM]=EARLIER(DATA[ITEM])),DATA[Supplier Code]),[Supplier Code],",")

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors