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 Apps
Answered

Pivot collection

(1) ShareShare
ReportReport
Posted on by 169
I ingest a Sharepoint list into a Powerapps collection.  It has a single column, so the collection is like this.
 
Value
-------
Company1
Company2
Company3
 
I want to turn this collection, so that Company1, Company2 and Company3 are column headings in a new collection then add values.  New collection should be like this.
 
Company1   Company2  Company3
4                      5                7
 
What's the best way to do this?
Categories:
I have the same question (0)
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,204 Super User 2026 Season 1 on at
    Hi,
     
    Note: Power Apps does not support creating column names dynamically at runtime in a collection.
     
    Instead, use a key value structure:
     
    ClearCollect(
        colResults,
        AddColumns(
            colCompanies,
            Score,
            Switch(
                Value,
                "Company1", 4,
                "Company2", 5,
                "Company3", 7
            )
        )
    )
     
    Result:
    Value    Score
    Company1    4
    Company2    5
    Company3    7

    Keep the data in a normalized format:
    Company     Score
    -------     -----
    Company1      4
    Company2      5
    Company3      7
    This works much better with galleries, forms, filtering, sorting, and patching than dynamically generated column names.
     
    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz
  • Suggested answer
    11manish Profile Picture
    3,333 on at
    Power Apps does not natively support creating collection column names dynamically from data values.
     
    The best practice is usually to keep the data in rows (Company, Value) rather than converting company names into columns.
     
    If you need a true pivot table with dynamic column names, Power Apps is not the ideal place to do the transformation. Consider using:
    • Power Automate
    • SQL
    • Excel
    • Power BI
    • Dataverse views
    to pivot the data before it reaches the app.
  • Suggested answer
    Valantis Profile Picture
    6,735 on at
     
    Power Apps can't create column names dynamically from data values that's a confirmed platform limitation. Riyaz and 11manish are right.

    If you need the pivoted display (Company1, Company2, Company3 as headers in a table), the cleanest approach is to keep the data in the key-value format (Company, Score) and use a horizontal gallery in Power Apps that renders each company as a column header dynamically. This gives the visual appearance of a pivot table without needing dynamic schema.

    If the data genuinely needs to arrive pre-pivoted, do the pivot in Power Automate before loading it into the collection, or use a SharePoint view with calculated columns. Either way, do the transformation outside Power Apps.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • AH-02011058-0 Profile Picture
    169 on at
    The list of companies can vary, so I don't want to hardcode.  It looks like Power Automate with a powerapps trigger is the way forward.  Has anyone done something like this?
     
    I looked at this, but couldn't get the addProperty to work on my array.
     
     
     
    I also had issues when Power automate wanted an array not an object.  I tried passing the powerapps collection as a string with and without the JSON function.  Either the Parse JSON step failed or I couldn't iterate through the result in Power Automate.
    Does anyone have a Flow I can go through step by step?
  • Valantis Profile Picture
    6,735 on at

    Hi @AH-02011058-0,

    Just wanted to check in and see if everything is working now. If you still need any help, feel free to let me know.

    Also, if the issue is resolved, it would be great if you could mark the answer as solved so others with the same question can find it easily.

     

    Thanks and have a great day!

     
  • Verified answer
    AH-02011058-0 Profile Picture
    169 on at
    Thanks for your contributions everyone.  I ended up restructuring the Sharepoint list, so I didn't need the Flow to pivot the data.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard