Forum Discussion

TiffanyCui's avatar
TiffanyCui
Helper I
5 years ago

Transpose Help

Hi everyone,

 

I need help with one transpose. For example, when I create the tables, all the columns are in tabular format,

but I want to transpose one specific column into a row, which means one "sequence" number, below is the note about that "Sequence" but transposed, so as all the rest of the "Sequence" numbers.

Thank you for your patience and time and hope to hear back from you soon.

 

Thank you,

Tiffany

9 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion
    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("PU+5EQQhDOuFWAE2r2vZ2f7bOMkcG6BBD8Z6nmIFZQliEWwTfKeGWLANshdPcWqf6XqwU6IPN5Ao1SS1a07FvKfGBKaBTLl+3dARrCMhEIF1UoOSjimwFW+CAQtsA4lS82tQCV0f2/w3qOgOMuXUb+qXHrfHyC07eqjGOB3SUIfQrWloeGqIjVYRJ5dL5Xq13p6jpghKrApSJa1ey/xOa5EazDkPZO/7Aw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Sequence = _t, Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Notes = _t]),
        Custom1 = Table.Combine(Table.Group(Source,"Sequence",{"n",each Table.RemoveColumns(_,"Notes")&#table({"Sequence","Column1"},{{"Notes",Text.Combine([Notes],";")}})})[n])
    in
        Custom1

    is this what you want?

     

  • Hi everyone,

     

    I need help with one transpose. For example, when I create the tables, all the columns are in tabular format,

    but I want to transpose one specific column into a row, which means one "sequence" number, below is the note about that "Sequence" but transposed, so as all the rest of the "Sequence" numbers.

    Thank you for your patience and time and hope to hear back from you soon.

     

    Thank you,

    Tiffany

    • FarhanAhmed's avatar
      FarhanAhmed
      Community Champion

      A few unclear requirements. Kindly share the sample data and desired output.

       

      What are the criteria for converting Note into a column, will Note be repeating/transposing against each row of your data?

  • Hi everyone,

     

    I need help with one transpose. For example, when I create the tables, all the columns are in tabular format,

    but I want to transpose one specific column into a row, which means one "sequence" number, below is the note about that "Sequence" but transposed, so as all the rest of the "Sequence" numbers.

    Thank you for your patience and time and hope to hear back from you soon.

     

    Thank you,

    Tiffany

    • mahoneypat's avatar
      mahoneypat
      Microsoft Employee

      Can you provide some sample/mock data of input and desired output?  Also, what do you plan to do with data structured that way?  Perhaps there is an alternate approach we can propose.

      Pat

       

    • TiffanyCui's avatar
      TiffanyCui
      Helper I

      Hi Pat,

      For example, this is the input of the table

       

      The desired output is to transpose "Work Instructions Notes",for example, "cosmetic" to a row right below its sequence number "110", and whatever in the notes will be below "Op code" "Op name" and "work center". Work Instructions Notes will be a separate row for this specific Sequence.

      So there will be a big amount of sequence numbers with Work Instructions Notes and each work instruction will be right below that sequence number. Also, I need to print out the full PDF report about all the data. As we know, online service PDF is not able to print out all the columns and rows. I'm thinking about how to make this happen through Paginated Reports using Report Builder.

       

      Thank you for your patience, Pat.

       

      • mahoneypat's avatar
        mahoneypat
        Microsoft Employee

        Thank you for the additional information.  Rather than re-structure your data, you should be able to accomplish that just on the report side (Power BI or Paginated Reports).  For example, you could add an expression that concatenates those two fields along with a carriage return.  Or you could nest report elements under a group.

         

        Pat

         

  • Hi everyone,

     

    I need help with one transpose. For example, when I create the tables, all the columns are in tabular format,

    but I want to transpose one specific column into a row, which means one "sequence" number, below is the note about that "Sequence" but transposed, so as all the rest of the "Sequence" numbers.

    Thank you for your patience and time and hope to hear back from you soon.

     

    Thank you,

    Tiffany

  • TiffanyCui ,

    I doubt you can transpose a single column.

    In power query, you can transpose the table

     

    In matrix visual you can move measures/values on on row(using show on row)