Forum Discussion

Revathi_Kannan's avatar
4 years ago

Switch row to column on Data table

Hi Everyone,

 

I have a data table wherein i need to transponse the row to column but my challenge is, it has more than 2 lacs records connected with SQL.

 

Is this possible to transpose in Power BI.? Please refer the example on my snapshot.

 

3 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    Transform menu - Use headers as first row

    Transform menu - Transpose

    See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXJ0BBKGRkbGSrE60UpGQI6TE0gELmQM5Dk7QxSBBUyAbBcXuK5YAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Sap_customer_code = _t, MSC_CODE = _t, Company_code = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Sap_customer_code", Int64.Type}, {"MSC_CODE", type text}, {"Company_code", Int64.Type}}),
        #"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"),
        #"Transposed Table" = Table.Transpose(#"Demoted Headers")
    in
        #"Transposed Table"

     

    • Revathi_Kannan's avatar
      Revathi_Kannan
      Helper I

      Vijay_A_Verma  Thank you so much for the reply however how could i able to bring all my 2 lacs records into this query. That is my challenge.

      • Vijay_A_Verma's avatar
        Vijay_A_Verma
        Most Valuable Professional

        Get your data in PQ from your source. Then follow the below steps

        Transform menu - Use headers as first row

        Transform menu - Transpose

         

        If you are still facing issue in getting data into PQ, please provide details of your source and problem being faced.