cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
P_SA
Helper V
Helper V

Transpose rows to columns in PowerApps

Hello, I want to transpose below data into rows so that I can insert this into a gallery..

P_SA_1-1663588601736.png

 

I want the data to be in this format.

P_SA_2-1663588666002.png

KIndly help

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@P_SA 

It will all be manual!!  There is no function to do what you need.

 

To do this manually, you will be creating a table of the initial record column values.  They will all need to be the same data type.  You cannot mix text and numeric in the formula.  Either it is all text or all numeric.

 

The following formula would convert the record you have shown into a table with a Name and Value column for each row.

With({_rec: yourRecordhere},
    Ungroup(
        Table({Name: "amount", Value: Text(_rec.amount)},
              {Name: "amountGBP", Value: Text(_rec.amountGBP)},
              ...etc...
        ),
        "Name"
    )
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

9 REPLIES 9
P_SA
Helper V
Helper V

@RandyHayes  Can you help here please.?

RandyHayes
Super User
Super User

@P_SA 

It will all be manual!!  There is no function to do what you need.

 

To do this manually, you will be creating a table of the initial record column values.  They will all need to be the same data type.  You cannot mix text and numeric in the formula.  Either it is all text or all numeric.

 

The following formula would convert the record you have shown into a table with a Name and Value column for each row.

With({_rec: yourRecordhere},
    Ungroup(
        Table({Name: "amount", Value: Text(_rec.amount)},
              {Name: "amountGBP", Value: Text(_rec.amountGBP)},
              ...etc...
        ),
        "Name"
    )
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

HI @RandyHayes , thank you for the answer, I have applied your formula. but this is how I get the result. 

 

P_SA_0-1663600144172.png

 

the data is not proper still

RandyHayes
Super User
Super User

@P_SA 

Yes, you will get those results with that formula!  You have it backward from what I sent.

You have the Name and Value switched.  Please review the formula I provided for more detail.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Yes I have switched it and now I get two columns out of which  one is a table. Is this correct and how do I display the value column in the gallery using below data

P_SA_0-1663601532028.png

 

RandyHayes
Super User
Super User

@P_SA 

That is because you are specifying a table as your source and not a record.

 

What is colClientDetails? And you only want the first record from it??

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
P_SA
Helper V
Helper V

colClientDetails is a collection which holds client information. it has Parent child relationship.. Example one client can have multiple WIP values..  In the colClientDetails collection WIP is a table. that is why I have used first to fetch the records only for WIP using this  First(colClientDetails.WIP).WIP. 

RandyHayes
Super User
Super User

@P_SA 

Yes, but like I said...WIP is a table!  That is why you are seeing what you are seeing.

You need to specify a record.  Your First(colClientDetails).WIP is going to return a table (the WIP table).

If you are only concerned about the first record of that, then you need to specify:  First(First(colClientDetails).WIP)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you @RandyHayes .. this worked.

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,574)