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 columns into r...
Power Apps
Unanswered

Convert columns into rows in Power apps Data table

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

we have the data in data table, need to convert the rows in to columns.

 

Columns Name : Quarter

Data                 : YearQ1,Year-Q2,Year-Q3

Column name: Overall avg

Data:33

Column name: Traffic

Data: Red

 

out put shoudl be as below

Columns Name : YearQ1

Data                 :33

Column name: Year-Q2

Data:33

Column name: Year-Q3

Data: 33

 

Please help me to achive the above requirement

Categories:
  • Meneghino Profile Picture
    6,949 on at

    You can do this with a GroupBy followed by an AddColumns.

    The exact syntax will depend on what you are more specifically trying to do.

    Something like:

    AddColumns(
     GroupBy(
     YourTable,
     [your grouping criteria],
     "AllRows"
     ),
     "Year-Q1", [not sure if - is a good idea in column names]
     LookUp(AllRows, [criteria], OverallAvg),
    etc. etc.
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    No , the Addcolumns is not working out for the below table which is in the attached image.

    Because the result of the table itself is acheieved by group by and add columns.so its reconginzing the column names one more time in add columns.

     

     

    Capture.PNG
  • Meneghino Profile Picture
    6,949 on at

    What expression did you try and what was the result?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Here is the formula thats creating the attached table. Please suggest how can i change the formula to convert the rows to column and columns to rows.

     

    AddColumns(GroupBy(Filter(YearTasks,If(IsBlank(SelectedEndDate)||IsBlank(SelectedStartDate),true,ActualEndDate >= SelectedStartDate && ActualEndDate <= SelectedEndDate)),"YearQ","QuaterwiseTasks"),"Name",YearQ,"EffortAdherence",Sum(QuaterwiseTasks,EffortAdherence)/Count(Filter(QuaterwiseTasks,EffortAdherence=1 ||EffortAdherence=3 ||EffortAdherence=5).ID),"ScheduleAdherence",Sum(QuaterwiseTasks,ScheduleAdherence)/Count(Filter(QuaterwiseTasks,ScheduleAdherence=1 ||ScheduleAdherence=3 ||ScheduleAdherence=5).ID),"QARating",Sum(QuaterwiseTasks,QARating)/Count(Filter(QuaterwiseTasks,QARating>=1 && QARating<=5).ID))

    Capture.PNG
  • Meneghino Profile Picture
    6,949 on at

    Wow, there is a lot going on.

    I think it might be easier if I show you what I mean.

    Assume that you have loaded your table to a collection like this:

    ClearCollect(
     BaseTable,
     Table(
     {Quarter: "2018-Q3", OverallAvg: 2.78, TrafficLight: "Yellow"},
     {Quarter: "2018-Q4", OverallAvg: 2.92, TrafficLight: "Yellow"}
     )
    )

    Then this is the gallery Items property you would use:

    AddColumns(
     Table({DummyColumn: 1}),
     "Q3-2018", LookUp(BaseTable, Quarter="2018-Q3", OverallAvg),
     "Q4-2018", LookUp(BaseTable, Quarter="2018-Q4", OverallAvg)
    )

    To get this:

     

    1.JPG

     

    You will need the GroupBy in case the data has more structure to it, but since you have only given me two lines, it is impossible to know.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This formula is generating only one row for OverallAvg

     

    if i want to create one more row  for Traffic Light , how can i change this formula.

     

    AddColumns(
        Table({DummyColumn: 1}),
        "Q3-2018", LookUp(BaseTable, Quarter="2018-Q3", OverallAvg),
        "Q4-2018", LookUp(BaseTable, Quarter="2018-Q4", OverallAvg)
    )

  • Meneghino Profile Picture
    6,949 on at

    Something like this:

     

    AddColumns(
     Table({RowId: "OA"},{RowId: "TL"}),
     "Q3-2018", LookUp(BaseTable, Quarter="2018-Q3", If(RowId="OA", Text(OverallAvg), TrafficLight)),
     "Q4-2018", LookUp(BaseTable, Quarter="2018-Q4", If(RowId="OA", Text(OverallAvg), TrafficLight))
    )
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Can I add the Quarters-"Q3-2018" dynamically based on the data in collection

     

     

    AddColumns(
        Table({RowId: "OA"},{RowId: "TL"}),
        "Q3-2018", LookUp(BaseTable, Quarter="2018-Q3", If(RowId="OA", Text(OverallAvg), TrafficLight)),
        "Q4-2018", LookUp(BaseTable, Quarter="2018-Q4", If(RowId="OA", Text(OverallAvg), TrafficLight))
    )

  • CP0822 Profile Picture
    66 on at

    Hi,

     

    I want to do something very similar but what I have is a TextInput with multiple lines and then save each line a specific column of a collection.

     

    How can I use the same logic that you use on this example for this?

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard