Forum Discussion

BAAJQH's avatar
BAAJQH
Frequent Visitor
1 year ago
Solved

From Row to Column

Hello All
I have an urgent question that I unfortunately cannot find the answer to

I have a Dataset like the first picture
Now I would like to see the column status grouped in the column with the corresponding changeddate below it

as I show in the second picture

just to be clear i have about 10 different statuses (i am showing 4 now)
if anyone could help me I would be very happy
Kind regards, Bert

 

 

 

 

  • Hi 

    Gökberk Uzuntaş

    you are amazing I didn't know it would be that easy thanks again

    // Bert

5 Replies

  • Hello you can use below M Language I made an example. Copy the code and paste into advance editor.

    "

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8vMxNDU3NLCIN1DSUQp3DAgIAtKGJromukYGRkYKhsZWRuZWpkZKsTpoap39fbGqtrAyMkNSbWiA22RjQytjc0y1OEw2tbQyMFCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PO_Rev = _t, status = _t, changedate = _t]),
    #"Pivoted column" = Table.Pivot(Table.TransformColumnTypes(Source, {{"status", type text}}), List.Distinct(Table.TransformColumnTypes(Source, {{"status", type text}})[status]), "status", "changedate")
    in
    #"Pivoted column"
    "
    Original Data

    Pivoted Data

    This is where you can paste the code ı given

    Example the code.

     

    Kind Regards,
    Gökberk Uzuntaş

    📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!

    🔗 Stay Connected:
    📘 Medium |
    📺 YouTube |
    💼 LinkedIn |
    📷 Instagram |
    🐦 X |
    👽 Reddit |
    🌐 Website |
    🎵 TikTok |



    • BAAJQH's avatar
      BAAJQH
      Frequent Visitor

      Hi
      thanks for the quick response
      My knowledge in M ​​code is limited would it be possible for you to add the adjustment in my existing code

      "

      let
      Bron = DremioCloud.DatabasesByServerV370("client.dremio.prod.gf.aws.scania.com:31010", null, null, null, null, "Enabled-PEM", []),
      Cloud_Datalake.maximo_production_logistics.prod.raw_Schema = Bron{[Name="Cloud_Datalake.maximo_production_logistics.prod.raw",Kind="Schema"]}[Data],
      postatus_View = Cloud_Datalake.maximo_production_logistics.prod.raw_Schema{[Name="postatus",Kind="View"]}[Data],
      #"Rijen gefilterd" = Table.SelectRows(postatus_View, each ([orgid] = "NL")),
      #"Samengevoegde kolom ingevoegd" = Table.AddColumn(#"Rijen gefilterd", "PO_Rev", each Text.Combine({[ponum], Text.From([revisionnum], "nl-NL")}, "_"), type text),
      #"Removed Columns" = Table.RemoveColumns(#"Samengevoegde kolom ingevoegd",{"changeby", "memo", "orgid", "ponum", "postatusid", "revisionnum", "rowstamp", "siteid", "dl_import_timestamp"}),
      #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"PO_Rev", "status", "changedate"})
      in
      #"Reordered Columns"

      "

      Best Regards,

      • uzuntasgokberk's avatar
        uzuntasgokberk
        Super User

        Hello BAAJQH ,

        Well, ı dont know how the data was like in the beginning. So I would assume end of the your applied step your data is like below:

        First select your column and then in the home section select pivot.

        And your values needs to be date as your case without aggregated.

         

         

        Kind Regards,
        Gökberk Uzuntaş

        📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!

        🔗 Stay Connected:
        📘 Medium |
        📺 YouTube |
        💼 LinkedIn |
        📷 Instagram |
        🐦 X |
        👽 Reddit |
        🌐 Website |
        🎵 TikTok |

  • BAAJQH's avatar
    BAAJQH
    Frequent Visitor

    Hi 

    Gökberk Uzuntaş

    you are amazing I didn't know it would be that easy thanks again

    // Bert

    • uzuntasgokberk's avatar
      uzuntasgokberk
      Super User

      Hello BAAJQH ,

      You're welcome. If you directly link the accepted solution, it will be easier for others to find it.

      Kind Regards,
      Gökberk Uzuntaş

      📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!

      🔗 Stay Connected:
      📘 Medium |
      📺 YouTube |
      💼 LinkedIn |
      📷 Instagram |
      🐦 X |
      👽 Reddit |
      🌐 Website |
      🎵 TikTok |