cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ArupBan
Level: Power Up

Facing challenge with GroupBy formula.. Help!!!

Hi Experts,

 

I am pretty new to powerapps. I am trying to create a basic application using sharepoint lis.

I am facing issue to implement following formula.

i have two tables.

Table1 {ID,Region,Subregion,Agent,ProjectID}

Table2 {ProjectID,ActionDate,AmountSpent}

 

I need to show Region, Subregion, Agent, ProjectID, TotalAmountSpent on a list form.

I am using following formula but it is not giving me blank rows.

LookUp(AddColumns(
GroupBy('Table2',"ProjectID","Group1"),
"SumOfSpentAmount",
Sum("Group1","AmountSpent")),ProjectID=ThisItem.ProjectID).SumOfSpentAmount

 

Please help me to find the issue.

 

Thanks,

Arup

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Facing challenge with GroupBy formula.. Help!!!

You're looking for an expression similar to the one below:

AddColumns(
    Table1,
    "SumOfSpentAmount",
    LookUp(
        AddColumns(
            GroupBy(Table2, "ProjectID", "ByProject"),
            "SumOfSpentAmount",
            Sum(ByProject, AmountSpent)),
        ProjectID = Table1[@ProjectID],
        SumOfSpentAmount))

This will give you a new table with the column 'SumOfSpentAmount' whose value comes from the grouping / sum that is done on the second table.

View solution in original post

2 REPLIES 2
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Facing challenge with GroupBy formula.. Help!!!

You're looking for an expression similar to the one below:

AddColumns(
    Table1,
    "SumOfSpentAmount",
    LookUp(
        AddColumns(
            GroupBy(Table2, "ProjectID", "ByProject"),
            "SumOfSpentAmount",
            Sum(ByProject, AmountSpent)),
        ProjectID = Table1[@ProjectID],
        SumOfSpentAmount))

This will give you a new table with the column 'SumOfSpentAmount' whose value comes from the grouping / sum that is done on the second table.

View solution in original post

ArupBan
Level: Power Up

Re: Facing challenge with GroupBy formula.. Help!!!

Hi Carlos,

 

Thanks for your reply.

I understand the issue in my formula. I was passing GroupName and Fieldname as string into Sum formula.

I removed "" marks and now it is working fine.

 

Thanks,

Arup

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,124)