cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Community Support
Community Support

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
Super User II
Super User II

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. 

Community Support
Community Support

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

thank you very much for your help!

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,494)