cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Join of two Collections with sum up by Id

How would you try to get "D"?

 

Is there a easy solution by powerapps?

In my case, of course I have not only 2 columns, there are a few more and some differ from shop1 to shop2 , but I want them as "Details" in the main result table as well (special columns of shop 1 are empty for shop 2)...

 

PowerDapp2_0-1593088372652.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Join of two Collections with sum up by Id

Hi @PowerDapp2 :

I strongly agree with @gabibalaban .My code is a little bit different from his, used to solve the "=0" problem.

Add a button and set it's OnSelect property to:

 

ClearCollect(
    IceCreamAll;
    IceCream1;
    IceCream2
);
ClearCollect(
    collectionD;
    ShowColumns(
        AddColumns(
            GroupBy(
                IceCreamAll;
                "Flavor";
                "Group"
            );
            "Quantity";
            Sum(
                Group;
                Quantity
            );
            "Min";
            If(
                CountRows(Group) = 1;
                0;
                Min(
                    Group;
                    Quantity
                )
            );
            "Max";
            Max(
                Group;
                Quantity
            )
        );
        "Flavor";
        "Quantity";
        "Min";
        "Max"
    )
)

 

1.JPG

Best Regards,

Bof

View solution in original post

3 REPLIES 3
Highlighted
Impactful Individual
Impactful Individual

Re: Join of two Collections with sum up by Id

I think you can use this formula:

 

ClearCollect(FinalTable,AddColumns(GroupBy(IceCreamAll,"Flavor","Result"),"Quantity",Sum(Result,Quantity),"Min",Min(Result,Quantity),"Max",Max(Result,Quantity)))

 

It not solve the problem with min=0 when you have only one flavor record (like choco and pistachio) but you can work on it. 

Highlighted
Community Support
Community Support

Re: Join of two Collections with sum up by Id

Hi @PowerDapp2 :

I strongly agree with @gabibalaban .My code is a little bit different from his, used to solve the "=0" problem.

Add a button and set it's OnSelect property to:

 

ClearCollect(
    IceCreamAll;
    IceCream1;
    IceCream2
);
ClearCollect(
    collectionD;
    ShowColumns(
        AddColumns(
            GroupBy(
                IceCreamAll;
                "Flavor";
                "Group"
            );
            "Quantity";
            Sum(
                Group;
                Quantity
            );
            "Min";
            If(
                CountRows(Group) = 1;
                0;
                Min(
                    Group;
                    Quantity
                )
            );
            "Max";
            Max(
                Group;
                Quantity
            )
        );
        "Flavor";
        "Quantity";
        "Min";
        "Max"
    )
)

 

1.JPG

Best Regards,

Bof

View solution in original post

Highlighted
Helper I
Helper I

Re: Join of two Collections with sum up by Id

thank you very much for your help!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,925)