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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Cyborg-0
New Member

Concatenate row values by sequence# and ID

 

Hi all

I have an address table with 3 x columns: ID, Seq#, Address.

I'm trying to concatenate the respective ADDRESS values (to make full address) based on order of SEQ numbers against each ID_NUMBER.

 

Note: I'm using DirectQuery, not Import.

 

Concatenate Address.jpg

1 REPLY 1
kaushikd
Resolver II
Resolver II

Your Desired output can be possible but we have to do some modelling with the source data.

Please have a look into the model which is suitable for holding the Address RecordsCapture.PNG

 

Steps:-

1. Go to the Edit Query

2. Select both SEQ and ADDRESS Column

3. Go to the Transform tab and select Pivot Column(in Advanced option choose Don't Aggregate).

4. Close and Apply

5. Right click on your Dataset and click New Column

6. Paste the DAX

ADDRESS = IF(SEARCH(",",SUBSTITUTE(
CONCATENATE('Address'[0],
CONCATENATE(",",
CONCATENATE('Address'[1],
CONCATENATE(",",
CONCATENATE('Address'[2],
CONCATENATE(",",
CONCATENATE('Address'[3],
CONCATENATE(",",
CONCATENATE('Address'[4],
CONCATENATE(",",
CONCATENATE('Address'[5],
CONCATENATE(",",
CONCATENATE('Address'[6],"")
)
)
)
)
)
)
)
)
)
)
)
),",,",","
)
)=1,REPLACE(SUBSTITUTE(
CONCATENATE('Address'[0],
CONCATENATE(",",
CONCATENATE('Address'[1],
CONCATENATE(",",
CONCATENATE('Address'[2],
CONCATENATE(",",
CONCATENATE('Address'[3],
CONCATENATE(",",
CONCATENATE('Address'[4],
CONCATENATE(",",
CONCATENATE('Address'[5],
CONCATENATE(",",
CONCATENATE('Address'[6],"")
)
)
)
)
)
)
)
)
)
)
)
),",,",","
)
,1,1," "
),SUBSTITUTE(
CONCATENATE('Address'[0],
CONCATENATE(",",
CONCATENATE('Address'[1],
CONCATENATE(",",
CONCATENATE('Address'[2],
CONCATENATE(",",
CONCATENATE('Address'[3],
CONCATENATE(",",
CONCATENATE('Address'[4],
CONCATENATE(",",
CONCATENATE('Address'[5],
CONCATENATE(",",
CONCATENATE('Address'[6],"")
)
)
)
)
)
)
)
)
)
)
)
),",,",","
)
)

 

 

Now please note in the Dax we are using SUBSTITUTE function to remove unwanted (comma)

and again using a REPLACE function to remove comma if encountered at first place

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.