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

Table grouping by passing columns name from anther table

Hi guys

 

I'm trying to group my product export csv file by a few keys and an aggregatedColumns "Variant SKU". I got errors on the aggregatedColumns column that added. I spent a few hours searching for a solution on the web, and most suggest using Record.Field to get the column data from passing a column name. Please help.

 

excel file: Product List sample.xlsm 

source csv: products_export_1.csv 

expected result: expecting result.csv 

 

Problematic code: (in table "Product List Grouped SKUs")

 

= Table.Group(#"Added Custom", Table.Column(#"Product List Header Group Key", "Key"), {{"Variant SKUs", each Text.Combine(Record.Field(Record.FromTable(#"Product List Header Group Aggregate"), "Aggregate Column"), ", ")}})

 

 

Table "Product List Header Group Aggregate":

jlauyfc_1-1720457762386.png

Table "Product List Header Group Key"

jlauyfc_2-1720457811376.png

 

Error

jlauyfc_3-1720458111056.png

 

Error Detail 1: (this error cannot be reproduced in the sample)

Expression.Error: The key didn't match any rows in the table.
Details:
Key=
Title= xxxxx

Body (HTML)=xxxxx

....

..

Error Detail2:

Expression.Error: The field 'Name' of the record wasn't found.
Details:
Column #=Column18
Aggregate Column=Variant SKU

 

Please help😔

1 ACCEPTED SOLUTION

I can't help you with Error #1 since, as you wrote, the sample does not reproduce it.

 

For Error #2,  try this for your #"Grouped Rows" step

    #"Grouped Rows" = Table.Group(#"Added Custom", Table.Column(#"Product List Header Group Key", "Key"), {
        {"Variant SKUs", 
    each Text.Combine(Table.Column(_, #"Product List Header Group Aggregate"[Aggregate Column]{0}),", ")}})

 

Results

ronrsnfld_0-1720555145282.png

 

 

 

View solution in original post

9 REPLIES 9
dufoq3
Super User
Super User

Hi @jlauyfc, i do not understand the purpose but I've solved your error:
BTW: you should read about functions before you use them, the issue was with Record.FromTable - for this function you have to specify Name and Value.

 

dufoq3_0-1720548288017.png

= Table.Group(#"Added Custom", Table.Column(#"Product List Header Group Key", "Key"), {{"Variant SKUs", each Text.Combine(#"Product List Header Group Aggregate"[Aggregate Column], ",")}})

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

foodd
Super User
Super User

Hello @jlauyfc , and thank you for sharing your question with the Community.  This reply is informational. Please follow the decorum of the Community Forum when asking a question.

Please share your work-in-progress Power BI Desktop file (with sensitive information removed) and any source files in Excel format that fully address your issue or question in a usable format (not as a screenshot). You can upload these files to a cloud storage service such as OneDrive, Google Drive, Dropbox, or to a Github repository, and then provide the file's URL.

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

 

If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.  Proud to be a Super User!

jlauyfc
Frequent Visitor

I am using power query in excel but not "Power BI Desktop", so what file should I share?

That is easy!  Share any related source files and your work-in-progress Excel (.xlsx) file in the same manner as you would if it were a Power BI Desktop File. By doing this, it will provide community members assisting you with a clearer understanding of your issue within the correct context. Thank you!

 

If your requirement is solved, please make THIS ANSWER a SOLUTION ✔️ and help other users find the solution quickly. Please hit the LIKE 👍 button if this comment helps you.  Proud to be a Super User!

jlauyfc
Frequent Visitor

I've uploaded the excel file, source csv and the expected result sample files.

You need to make those files accessible.

fixed. Thanks.

I can't help you with Error #1 since, as you wrote, the sample does not reproduce it.

 

For Error #2,  try this for your #"Grouped Rows" step

    #"Grouped Rows" = Table.Group(#"Added Custom", Table.Column(#"Product List Header Group Key", "Key"), {
        {"Variant SKUs", 
    each Text.Combine(Table.Column(_, #"Product List Header Group Aggregate"[Aggregate Column]{0}),", ")}})

 

Results

ronrsnfld_0-1720555145282.png

 

 

 

It is working now. Luckily error 1 disappeared🤣. Thanks for your help!

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors