cancel
Showing results for 
Search instead for 
Did you mean: 

Transpose table in SAP Data Warehouse Cloud

juanforero5
Participant
0 Kudos

Hi experts!

I have a table in DWC that I need to transpose, I would like to know how I can do it in DWC?

Regards!!

Accepted Solutions (0)

Answers (2)

Answers (2)

XaviPolo
Active Contributor
0 Kudos

Yes it's possible to do with SQL, but HANA doesn't have the PIVOT/UNPIVOT commands, so you need to do with "plain" SQL .

There are different ways to do that but depends on number of fileds, type of fields to transpose, etc.

The easy solution is to do a Case When and then a Sum like in How to pivot/unpivot in SAP HANA | SAP Blogs, but be careful with memory consumption if you work with millions of rows.

Regards,

XaviPolo
Active Contributor
0 Kudos

If you are using Data Flows, you can do it with Pandas in Python transformation.

pandas.DataFrame.transpose — pandas 1.2.1 documentation (pydata.org)

BUT, output schema is not dynamic in DWC, so you need to define a fixed structure of fields.

kavanshah
Discoverer
0 Kudos

is there a way using SQL script?