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
CadenChow
Frequent Visitor

Append list of values from another table

Hi all, may I get some help of the challenge below? The key is how can I read all values from other table column and put to a fields in another table? Thanks.

 

1. I have a table with list of country and a product table with location

2. I would like to create a new column with logic:

if product[location] is null then Location = AU, SG, JP, HK

 

Screenshot 2021-04-06 040405.pngScreenshot 2021-04-06 040418.png

2 ACCEPTED SOLUTIONS

@CadenChow That will make it difficult to filter by location, but you can do it: 

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJRSiwoyElVitWJVvLwBnKTEvOAEMz3CgDyC1ITkzOUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Location = _t, Fruit = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Location", type text}, {"Fruit", type text}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Location Option B", each if [Location] = "" then Text.Combine(AllLocationsList, ", ") else [Location])
in
#"Added Conditional Column"

 

Where you must have a list of locations also available in Power Query. See the FruitsByLocation query in the attached file (below signature)


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

View solution in original post

12 REPLIES 12
AllisonKennedy
Super User
Super User

@CadenChow  Can you clarify your desired result please? It looks like you want to expand out the location column so in your example above you would end up with 4 rows for apple and 1 banana and 1 peach?

 

You need to use List functions, or you can create a mapping table: 

Old Location New Location
SG  SG 
JP  JP 
HK  HK 
AU  AU 
  SG 
  JP 
  HK 
  AU 

 

and merge this mapping table into the existing table using Location and Old location as the matching key columns. Then click the double arrow on the new column to expand the New Location column


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Thanks for your prompt reply. My desire result is to put all values in the location column to the null field.

Screenshot 2021-04-06 042517.png

@CadenChow That will make it difficult to filter by location, but you can do it: 

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUtJRSiwoyElVitWJVvLwBnKTEvOAEMz3CgDyC1ITkzOUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Location = _t, Fruit = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Location", type text}, {"Fruit", type text}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Location Option B", each if [Location] = "" then Text.Combine(AllLocationsList, ", ") else [Location])
in
#"Added Conditional Column"

 

Where you must have a list of locations also available in Power Query. See the FruitsByLocation query in the attached file (below signature)


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

I have tried to reproduce the solution but no luck....

 

When I tried to merge the tables they didn't map with all location but show null. Would you mind share more hints for that? Thanks.

Screenshot 2021-04-06 143026.pngScreenshot 2021-04-06 143044.png

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

@CadenChow choice are you trying to make? If you want option B, convert the locations to list (there is a button on the Transform tab), name it 'AllLocationsList', and then in the table add a custom column and place it in formula:

each if [Location] ? "" then Text.Combine(AllLocationsList, ", ") else [Location]

If you are trying a join, you need two columns in the location table.

@CadenChow  which option are you trying to do? If you want Option B, then convert the Locations to list (there's a button in Transform tab), name it 'AllLocationsList' and then in your table add a custom column and put this in formula: 

 

each if [Location] = "" then Text.Combine(AllLocationsList, ", ") else [Location]

 

If you're trying a merge, you need two columns in the location table. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.