web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Calculating the averag...
Power Apps
Answered

Calculating the average of column field from another sharepoint list

(1) ShareShare
ReportReport
Posted on by 23

I am trying to create a student submission tracker app, On one screen I have a course name drop-down menu that can be used to select a course then another drop-down is used to select the level (year) of the course. In the onchange property of the levels drop-down menu I have added the code seen in the image attached. I am using a data table to display modules data from the modules list but also I want to use the submissionratepercentage column from the assessments list to create a new column in the table to show the average submission rate for the modules  based on all assessments that belong to each module by adding the values up and dividing by their count. This is done by matching the module ID of the assessment to the module ID, but it seems to only consider 1 assessment per module and does not use the other assessments.

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,412 Super User 2025 Season 2 on at

    @mosy2 

     

    Pretty please 2 things.

     

    1. Use pictures not paragraphs of explanation it really benefits the people who cannot see it.

    1.b But I have photos. yes, but you need to stop multiple trains of thought and have the pictures make sense so the subject of your sentence

    2. Please don't write paragraphs of explanation, use pictures and short sentences with annotations or Code Snippets </>

     

    Help save our eyeballs as we help you 😉

     

    Note:

     

    1. I would recommend you use Concurrent here, because you will speed up your Collects instead of doing them 1 by 1

    2. You need to fix that delegation issue, it is going to bite you later

     

    Once I see a more like readable format etc (I did read this, but its just too verbal lashing) than a clear written flow of thought hehe

     

    I wanna help but need some clarity


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

     

     

  • Verified answer
    Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @mosy2 - if we just focused on what you're trying to do (rather than troubleshoot whatever solution you have already come up with), then as I understand it, you have a SharePoint List called "Modules" with displays a unique list of "ModuleIDs". You have another SharePoint List called "Assessments" which displays multiple ModuleIDs. This list includes a Number column called "SubmissionRatePercentage".

     

    What I think you're trying to do:

     

    You want to add a column into the Modules List which displays the average SubmissionRatePercentage for each Module. The way you want to calculate this is by summing the SubmissionRatePercentage value / the count of each module.

     

    Example one:

     

    AddColumns(
     Modules As data,
     SubmissionRateAvg,
     Sum(
     Filter(
     Assessments,
     ModuleID = data.ModuleID
     ),
     SubmissionRatePercentage
     ) / CountRows(
     Filter(
     Assessments,
     ModuleID = data.ModuleID
     )
     )
    )

     

    Example two (similar to the above but you're only calling the Assessments List once):

     

    With(
     {
     _grouped_data: AddColumns(
     Modules As _data,
     FilteredTable,
     Filter(
     Assessments,
     ModuleID = _data.ModuleID
     )
     )
     },
     AddColumns(
     _grouped_data,
     SubmissionRateAvg,
     Sum(
     FilteredTable,
     SubmissionRatePercentage
     ) / CountRows(FilteredTable)
     )
    )

     

    Example three (using GroupBy and LookUp):

     

    With(
     {
     _grouped_data: AddColumns(
     GroupBy(
     Assessments,
     ModuleID,
     GroupedItems
     ),
     SubmissionRateAvg,
     Sum(
     GroupedItems,
     SubmissionRatePercentage
     ) / CountRows(GroupedItems)
     )
     },
     AddColumns(
     Modules,
     SubmissionRateAvg,
     LookUp(
     _grouped_data,
     ModuleID = Modules[@ModuleID],
     SubmissionRateAvg
     )
     )
    )

     

    Notes:

     

    • All of the above examples leverage the AddColumns function, which is not delegable with any data source.
    • I notice you're using LookUp data types on the Module IDs to relate both lists. The above assumes the Module List and the Assessments List contains a column called "ModuleID". You will need to modify the above code to suit your needs/data.
    • You may want to consider using the Average function, but the above is what you asked for.
    • [Edit] I have just noticed @FLMike has responded to this thread. I would endorse all of his points - you will get to an answer quicker if you can provide a clear explanation as this post currently reads like a puzzle.
  • MA-21081317-0 Profile Picture
    23 on at

    @Amik Thanks for your help, Example 1 worked just fine, now I am getting the average submission rate for each module based on all the related assessments.

     

    I will consider @FLMike points.

    I am sorry if my post felt like a puzzle, this was my first post on here.

    From now on I will use short sentences and clear  images.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard