Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

How to calculate GPA in PowerApps

(0) ShareShare
ReportReport
Posted on by 18

I have a collection of Data with the following columns, 1. Batch , 2. Rating, 3. Date.

Steps that need to be followed to calculate the GPA

  1.  Calculate the Average rating of a month for a Batch. Example- If the data is a follows
    BatchRatingDate
    Java61/01/2023 12:00:00 AM
    Java71/15/2023 12:00:00 AM
    Java61/31/2023 12:00:00 AM
    Java82/31/2023 12:00:00 AM
    Python61/15/2023 12:00:00 AM
    Python71/31/2023 12:00:00 AM
    Python8 2/31/2023 12:00:00 AM
    Then the average rating for the batch Java for the 1st month will be (6+7+6) = 6.33 . 
  2. Calculate the average rating for a Batch. Lets take the same example given above then the average rating for a Batch Java will be (6.33+ 8)/2 = 7.16 and for Python it will be ((6+7)/2+8)/2 = 7.25 which is Sum of monthly average ratings for a batch / number of months the rating is given for a batch. 
  3. Now the GPA for this data will be the overall average i.e. Sum of ratings for a batch / total number of batches. For the above example the GPA will be (7.16+7.25)/2 = 7.205 which is average rating for Java + average rating for Python / 2 (Total number of batches).

How can i do the above calculation in PowerApps.

Categories:
  • Verified answer
    Ash8 Profile Picture
    Ash8 18 on at
    Re: How to calculate GPA in PowerApps

    This worked for me - 

    ClearCollect(
    Demo123,
    ForAll(
    Distinct(
    TestList,
    Batch
    ),
    {
    Batch: Value,
    Result: Average(
    ForAll(
    Distinct(
    Filter(
    TestList,
    Batch = Value,
    Month(Date) = Month(ThisRecord.Date)
    ),
    Batch & "," & Month(Date) & Year(Date)
    ),
    {
    Date: ThisRecord.Value,
    MonthAvg: (Sum(
    Filter(
    TestList,
    Month(Date) & Year(Date) = Last(Split(Value,",")).Value,
    Batch = First(Split(Value,",")).Value
    ),
    Rating
    ) / CountRows(
    Filter(
    TestList,
    Month(Date) & Year(Date) = Last(Split(Value,",")).Value,
    Batch = First(Split(Value,",")).Value
    )
    ))
    }
    ),
    MonthAvg
    )
    }
    )
    );

    Set(GPA, Round(Average(Demo123,Result),2));

  • Ash8 Profile Picture
    Ash8 18 on at
    Re: How to calculate GPA in PowerApps

    I have put together a formula but i am not getting the desired output in the collection D145 -  

    ClearCollect(
    D145,
    ForAll(
    Distinct(TestList, Batch),
    {
    Batch: Value,
    Result: Average(
    ForAll(
    Distinct(
    Filter(
    TestList,
    Batch = Value,
    Month(Date) = Month(ThisRecord.Date)
    ),
    Month(Date) & Year(Date)
    ),
    {
    Date: Value,
    MonthAvg: (Sum(
    Filter(
    TestList,
    Month(Date) & Year(Date) = Value,
    Batch = ThisRecord.Batch
    ),
    Rating
    ) / CountRows(
    Filter(
    TestList,
    Month(Date) & Year(Date) = Value,
    Batch = ThisRecord.Batch
    )
    ))
    }
    ),
    MonthAvg
    )
    }
    )
    );

    Set(
    GPA,
    Average(
    D145,
    Result
    )
    );

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,567

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard