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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection showing how...
Power Apps
Answered

Collection showing how many records per Created By value AND per Environment

(2) ShareShare
ReportReport
Posted on by 219
Hello,
 
If i have a sharepoint list called "Assignments" and within the list i have the following data fields/records
 
 
Sharepoint List  = Assignments
ID User_Email Assigned_Outlet Environment
1 my@email.com 12 Horeca
2 jack@jack.com 64 Convenience
3 my@email.com 85 Convenience
4 my@email.com 578 Convenience
5 jack@jack.com 83 FOTG
6 me@microsoft.com 2345 FOTG
 
How would i best create a collection which will look at the records, and will count how many records there are PER "User_Email" value but also count how many records there are per "Environment" value? for example, based on the above I'd have a collection which looks like the following:
 
User_Email Total Horeca Convenience FOTG
my@email.com 3 1 2 0
jack@jack.com 2 0 1 1
me@microsoft.com 1 0 0 1
 
I have the following code which lists each user and the total number of records, but I'm struggling to work out how best to add the additional columns for the Environment and the total records for each one by user.
 
If(
    vartoghoreca = true && vartogfotg = true,
    AddColumns(
        GroupBy(
            Filter(
                Questionnaire,
                Created >= FromDate_2.SelectedDate && Created <= ToDate_2.SelectedDate && StartsWith(
                    'Account Name 2',
                    txt_search_2.Value
                ) && Record_Status = "COMPLETED"
            ),
            Created_by_Email,
            UserGroup
        ),
        Count,
        CountRows(UserGroup)
    )
 
 
Any help would be much appreciated. Thank you in advance.
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    Probably something like this
    If(
       vartoghoreca && vartogfotg,
       AddColumns(
          GroupBy(
             Filter(
                Questionnaire,
                Created >= FromDate_2.SelectedDate && 
                Created <= ToDate_2.SelectedDate && 
                StartsWith(
                   'Account Name 2',
                   txt_search_2.Value
                ) && 
                Record_Status = "COMPLETED"
             ),
             Created_by_Email,
             UserGroup
          ),
          Total,
          CountRows(UserGroup),
          Horeca,
          CountRows(
             Filter(
                UserGroup,
                Environment = "Horeca"
             )
          ),
          Convenience,
          CountRows(
             Filter(
                UserGroup,
                Environment = "Convenience"
             )
          ),
          FOTG,
          CountRows(
             Filter(
                UserGroup,
                Environment = "FOTG"
             )
          )
       )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • CCEP_Mike Profile Picture
    219 on at
    Hi @WarrenBlez,
     
    Thank you very much for the support on this, worked perfectly!
     
    Much appreciate the support. Thank you.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard