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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,103)