cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndrewFitz
Advocate II
Advocate II

Help with Data/Table Summarizing into New Collection

I'm trying to take an existing collection of student records with scores and summarize the data into a new collection. The existing records look something like this:
Collection1.jpg

And I'm trying to summarize it by:

  1. Get my my Distinct Date values, then
  2. Get my Distinct StudentName values for each date, so I can
  3. Get the Average score for each Student, for each Date

So in the end, I have a new table like this:

Collection2.jpg

I've been able to put together a Distinct table for Date or StudentName and add the average score with AddColumns, but I can't figure out how to get all three columns organized and working together. I keep getting "[object Object], [object Object]" values and I'd like to avoid GroupBy because the resulting collection needs to feed into a Line Chart.


I'm stumped. Any help pointing me in the right direction is appreciated.

Andrew

1 ACCEPTED SOLUTION

Accepted Solutions
AndrewFitz
Advocate II
Advocate II

Holy Cow! I cannot express how excited I am to figure this out after so many hours of searching, reading, and video watching!

Here is my Formula:

ClearCollect(
    colNewCollection,
    AddColumns(
        ClearCollect(
            colGroupSummary,
            GroupBy(
                colOriginalCollection,
                "Date",
                "StudentName",
                "Summary"
            )
        ),
        "Average Score", 100 *
        Sum(
            Summary,
            Score
        )
        /
        CountRows(Summary)
    )
)

 
I dumped the resulting data into a Line Chart, and added a Filter (to the Chart) based on the item selection of a Gallery made up of a separate Distinct StudentName collection, and voila!

LIneChart.jpg

View solution in original post

1 REPLY 1
AndrewFitz
Advocate II
Advocate II

Holy Cow! I cannot express how excited I am to figure this out after so many hours of searching, reading, and video watching!

Here is my Formula:

ClearCollect(
    colNewCollection,
    AddColumns(
        ClearCollect(
            colGroupSummary,
            GroupBy(
                colOriginalCollection,
                "Date",
                "StudentName",
                "Summary"
            )
        ),
        "Average Score", 100 *
        Sum(
            Summary,
            Score
        )
        /
        CountRows(Summary)
    )
)

 
I dumped the resulting data into a Line Chart, and added a Filter (to the Chart) based on the item selection of a Gallery made up of a separate Distinct StudentName collection, and voila!

LIneChart.jpg

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,386)