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 / Convert rows to column...
Power Apps
Answered

Convert rows to columns in Power Apps

(0) ShareShare
ReportReport
Posted on by 183
Hi Power Apps Community,
 
I have an app fetching data from data verse table and would like to convert rows to columns and find the sum of quantity. 
 
Input Table
 
Expected output
 
 
tried achieving the expected result using group by. Could someone help accomplish above. Thanks 
 
SV 
Categories:
I have the same question (0)
  • Suggested answer
    Pacel1 Profile Picture
    79 on at
    I was tested this on my site, and below You have a working solution :)
     
    ClearCollect(
        tempCollection,                //Name of temp collection
        AddColumns(
            GroupBy(
                YourDataSet, //Reference to Your Collection 
                Client,         // First group Column
                Distributor,    //Second group Column
                Month,          //Third group Column
                Groupeddata     //Column with grouped data -- 
            ),
            SUM,                //Name of newly added column where Your summed data will present
            Sum(
                ThisRecord.Groupeddata,
                Quantity
            )
        )
    )
     
  • ronaldwalcott Profile Picture
    3,847 Moderator on at
    Do you just want to display the output or are you using the data for some other function as you could do this using Power BI? 
  • Suggested answer
    Daniel Bocklandt Profile Picture
    5,119 Super User 2026 Season 1 on at
     
    I have managed to do it like this (colTest is the Input Table): 
    ClearCollect(
        colInterm,
        AddColumns(
            colTest,
            ClientDistributor,
            Client & Distributor
        )
    );
    Clear(colResults);
    ClearCollect(
        colDistinct,
        Distinct(
            colInterm,
            ClientDistributor
        )
    );
    ForAll(
        colDistinct As X,
        With(
            {
                ClientValue: LookUp(
                    colInterm,
                    ClientDistributor = X.Value
                )
            },
            Collect(
                colResults,
                {
                    Client: ClientValue.Client,
                    Distributor: ClientValue.Distributor,
                    Month: ClientValue.Month,
                    Quantity: Sum(
                        Filter(
                            colInterm,
                            ClientDistributor = X.Value
                        ),
                        Quantity
                    )
                }
            )
        )
    )
    I don't know if it's the fastest way. Since this was my first attempt probably not but let me know it this works for you 

    If this solvede your porblem please accept it as solution so others can find it as well. 
    If it helped in any other way consider liking it so we can keep supporting eachother. 
  • CU20081036-0 Profile Picture
    183 on at
    @Pacel1,
     
    Thanks for the response. It works. How to convert column month to row like shown below. Thanks
     
  • Verified answer
    Pacel1 Profile Picture
    79 on at
    Hi, You should try something simmilar to previous solution. 
     
    ClearCollect(
        testowa1,                //Name of temp collection
        AddColumns(
            GroupBy(
                TempCollection1, //Reference to Your Collection 
                Client,         // First group Column
                Distributor,    //Second group Column
                Groupeddata     //Column with grouped data -- 
            ),
            JAN,                //Name of newly added column where Your summed data will present
            Sum(Filter(ThisRecord.Groupeddata, Month = "Jan"),
                Quantity
            ),
            FEB,                //Name of newly added column where Your summed data will present
            Sum(Filter(ThisRecord.Groupeddata, Month = "Feb"),
                Quantity
            ),
            MAR,                //Name of newly added column where Your summed data will present
            Sum(Filter(ThisRecord.Groupeddata, Month = "Mar"),
                Quantity
            )
        )
    )

    If this solved your porblem please accept it as solution :)
  • CU20081036-0 Profile Picture
    183 on at
    @Pacel1,
     
    I have run into an issue recently. Data that I'm after is present till AddColumns step, however, collecting it into collection fails with few records missing.
     
    Any suggestions on the troubleshooting would be helpful. Thanks

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 93 Most Valuable Professional

#2
Haque Profile Picture

Haque 81

#3
Valantis Profile Picture

Valantis 49

Last 30 days Overall leaderboard