cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
slong
Frequent Visitor

Using GroupBy with a subtable column name ?

Is there a way to use a column name in a sub table of a collection in the GroupBy function ?

My top level Collection looks like this 

slong_1-1612261232277.png

If I click on the fields table I get the following 

slong_2-1612261795039.png

I want to be able to be able to get all items assigned to a user but group them by a column in the subtable (i.e. the customfield_10014 column of fields). 

I've tried this 

 

GroupBy(Filter(jiraRawData, fields.assignee.displayName = varSelectedUser), "fields.customfield_10014", "grouped")

 

but get the following error 

slong_3-1612261991578.png

I'm all out of ideas. Any assistance much appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @slong :

Firstly,let me explain why you encountered this problem.

it is not available to group a table by a column in the sub-table.

Secondly,I suggest you first use AddColumns to extract the values in the sub-records.Please try this solution:

I assume that the value of fields is a record and not a table:

1\My data source:

ClearCollect(
    jiraRawData,
    {
        fields: {
            assignee: {displayName: "bof"},
            customfield_10014: "1"
        }
    },
    {
        fields: {
            assignee: {displayName: "bof"},
            customfield_10014: "2"
        }
    }
)

2\The Formula

GroupBy(
AddColumns(
   Filter(jiraRawData, fields.assignee.displayName = varSelectedUser),
   "NewCustomfield_10014",
   fields.customfield_10014
)
"NewCustomfield_10014",
"grouped"
)

Best Regards,

Bof

 

View solution in original post

1 REPLY 1
v-bofeng-msft
Community Support
Community Support

Hi @slong :

Firstly,let me explain why you encountered this problem.

it is not available to group a table by a column in the sub-table.

Secondly,I suggest you first use AddColumns to extract the values in the sub-records.Please try this solution:

I assume that the value of fields is a record and not a table:

1\My data source:

ClearCollect(
    jiraRawData,
    {
        fields: {
            assignee: {displayName: "bof"},
            customfield_10014: "1"
        }
    },
    {
        fields: {
            assignee: {displayName: "bof"},
            customfield_10014: "2"
        }
    }
)

2\The Formula

GroupBy(
AddColumns(
   Filter(jiraRawData, fields.assignee.displayName = varSelectedUser),
   "NewCustomfield_10014",
   fields.customfield_10014
)
"NewCustomfield_10014",
"grouped"
)

Best Regards,

Bof

 

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,291)