Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Building a GroupBy Gallery to show average score

(1) ShareShare
ReportReport
Posted on by 154
Hey all, I'm working on a gallery from a SharePoint data source.

My organization is doing a survey of all coworkers and wants a Power App dashboard built to review the data. The survey consists of 10 questions based on a strongly disagree to strongly agree scale. I've gone ahead and given point values to each of the choice optoins from 1 to 5. 

I want to take a local collection I've created within the PowerApp, and group by all of the responses by their work location. Then ultimately get the average for each work location using all 10 questions in a single new AddColumn.
 
I keep trying to use the GroupBy function, but I keep erroring out.
 
ClearCollect(groupedData, GroupBy(colProviderData, "ProviderLocation", "GroupData"));
ClearCollect(finalData, AddColumns(groupedData, "TotalScore", Sum(GroupData, QuestionTwoValue + QuestionThreeValue)));

 
Any help or insight would be greately appreciated!
Categories:
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,434 on at
    Building a GroupBy Gallery to show average score
    @NathanFra​​​​​​​
    Just adding a clarification - you do not need quotes "" around the parameters and you can do it all in one action. Please mark @mmbr1606's post as the solution as the calculation was your main question.
    ClearCollect(
       finalData, 
       AddColumns(
          GroupBy(
             colProviderData, 
             ProviderLocation, 
             GroupData
          ),
          TotalScore, 
          Sum(
             GroupData, 
             QuestionOneValue + QuestionTwoValue + QuestionThreeValue + QuestionFourValue + QuestionFiveValue + 
             QuestionSixValue + QuestionSevenValue + QuestionEightValue + QuestionNineValue + QuestionTenValue
          ) / 10
       )
    );
     
  • NathanFra Profile Picture
    NathanFra 154 on at
    Building a GroupBy Gallery to show average score
    @mmbr1606,

    I tried that, but the original ClearCollect on the groupedData is throwing an error.


    It is saying "expected identified name" to both of the strings.
  • Verified answer
    mmbr1606 Profile Picture
    mmbr1606 10,429 on at
    Building a GroupBy Gallery to show average score
    hey
     
     
    can u try this approach:
    ClearCollect(
        groupedData,
        GroupBy(colProviderData, "ProviderLocation", "GroupData")
    );
    
    ClearCollect(
        finalData,
        AddColumns(
            groupedData,
            "AverageScore",
            Sum(
                GroupData,
                QuestionOneValue + QuestionTwoValue + QuestionThreeValue + 
                QuestionFourValue + QuestionFiveValue + QuestionSixValue +
                QuestionSevenValue + QuestionEightValue + QuestionNineValue +
                QuestionTenValue
            ) / 10
        )
    );
    
    if it worked please mark as verified answer,
     
     
    cheers

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,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard