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 / How create a pivot tab...
Power Apps
Suggested Answer

How create a pivot table in Power Apps

(1) ShareShare
ReportReport
Posted on by 152
Hi,
I would like to create a dashboard like a pivot table in Power Apps.
I have a data source on Sharepoint  as below:
RecordDate: date
Name: Text
Status: choice column
Amount: number
ID RecordDate  Name Status Amount
1 08-01-2024 John In progress 10000
2 08-01-2024 Sarah In progress 5000
3 09-01-2024 Steve Reject 20000
4 10-01-2024 John Processed 3000
5 10-02-2024 John Processed 6000
6 10-02-2024 Steve Awiating payment 8000
7 11-04-2024 Sarah Return 6000
8 11-07-2024 Sarah Processed 10000

Is there a way to create a pivot table grouped by the Name and ungrouped by the status like in Excel for example?
 
Name Awiating payment In progress Processed Reject Return Total général
John   1 2     3
Sarah   1 1   1 3
Steve 1     1   2
Total général 1 2 3 1 1 8
 
Thanks
 
Categories:
I have the same question (0)
  • Suggested answer
    MichaelFP Profile Picture
    1,847 Super User 2025 Season 2 on at
    There is to way to achieve that.
     
    1 - Create a power bi and include in your dashboard
     
    This is the most correct thing to be done in your case. because Power BI suits better for what do you want, you can get the records in the way  that you want.
     
     
    2 - Create a Dataverse table to handle the data
     
    If you don't have license to use the Power BI because of the costs. You can try the second option, which means to create a Table in Dataverse to hold that information. You can create an flow that every time a record is created/update,  to count that values for each person. In that way you will be able to display in the way that you want in the dashboard.
  • KirstenD Profile Picture
    30 on at
    I've done this using a gallery, which allows the data to refresh as needed.
    • I put the headers outside the gallery
    • For the items, I use Distinct(Source,[Field for first column])
    • text control in the far left position with ThisItem.Value
    • for subsequent columns, I put text controls in each column and use countif or sumif or in my case average arguments to get my results
      • CountIf(DataSource,StatusField=ThisItem.Value && Assigned=AnalystOptions.'Sarah')
    In your example, I would put the statuses in the first column since there are more of them than people, and then make the people the columns like this:
     
  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at
    hi @Fada
     
    Please consider the following steps:
    1. Use your data source, i created a collection _data01 with sample data.
    2. Group the data by name and adds columns for the count of each status.
    3. Creates a collection _totalRow that calculates the sum of each status across all names.
    4. Combines the main data collection _tpdata with the total row to form _finalData.
    Your datasource, _data01
    ClearCollect(_data01, 
    {id: 1, recordDate: "08-01-2024", name: "John", status: "InP", amount: 1000},
    {id: 1, recordDate: "08-01-2024", name: "Sarah", status: "InP", amount: 500},
    {id: 1, recordDate: "09-01-2024", name: "Steve", status: "Rej", amount: 20000},
    {id: 1, recordDate: "10-01-2024", name: "John", status: "Prc", amount: 3000},
    {id: 1, recordDate: "10-01-2024", name: "John", status: "Prc", amount: 600},
    {id: 1, recordDate: "10-01-2024", name: "Steve", status: "AWP", amount: 8000},
    {id: 1, recordDate: "11-01-2024", name: "Sarah", status: "Ret", amount: 6000},
    {id: 1, recordDate: "11-01-2024", name: "Sarah", status: "Prc", amount: 10000}
    );
    It seems like you want to group the data and view the process by this grouping, no pivot or transposing of data is needed. - Group the data by name:
    // Group the data by 'name' and add columns for each status count
    ClearCollect(_tpdata,
        AddColumns(
            GroupBy(_data01, name, 'NamesGrouped'), // Group by 'name' and store grouped data in 'NamesGrouped'
            'Awaiting payment', CountRows(Filter(NamesGrouped, status = "AWP")), // Count 'AWP' status
            'In progress', CountRows(Filter(NamesGrouped, status = "InP")), // Count 'InP' status
            'Processed', CountRows(Filter(NamesGrouped, status = "Prc")), // Count 'Prc' status
            'Reject', CountRows(Filter(NamesGrouped, status = "Rej")), // Count 'Rej' status
            'Return', CountRows(Filter(NamesGrouped, status = "Ret")), // Count 'Ret' status
            'Total general', CountRows(NamesGrouped) // Count total records for each name
        )
    );
     
    Once your data is grouped and counted you only need to add the row total, for this you need another collection
    // Create a collection for the total row with sums for each status
    ClearCollect(_totalRow,
        {
            name: "Total", // Label for the total row
            'Awaiting payment': Sum(_tpdata, 'Awaiting payment'), // Sum of 'AWP' status counts
            'In progress': Sum(_tpdata, 'In progress'), // Sum of 'InP' status counts
            'Processed': Sum(_tpdata, 'Processed'), // Sum of 'Prc' status counts
            'Reject': Sum(_tpdata, 'Reject'), // Sum of 'Rej' status counts
            'Return': Sum(_tpdata, 'Return'), // Sum of 'Ret' status counts
            'Total general': Sum(_tpdata, 'Total general') // Sum of total records for each name
        }
    );
    Now a final one to add the total row
     
    // Combine the main data collection with the total row
    ClearCollect(_finalData, _tpdata); // Copy _tpdata to _finalData
    Collect(_finalData, _totalRow); // Add the total row to _finalData
    Result
    Initial Data (_data01)
     
    Final data (_finalData)
     
    I hope it helps you, have fun.
    R

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