Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Reorder table by rows from a month column

Dear community, I am starting working on PowerBI and I am creating a solution to register our monthly KPIs, so the users enter their values by month so in order to create a progress dashboard by month I would like to reorder my table like this:

 

Is it posiible to do?

Thank you!

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

     

    For your question, here is the method I provided:

     

    Here's some dummy data

     

    Load data into PowerBI.

     

    Use Power Query to convert the data.

     

    Click on the "Mes" column and in the Transform tab click on "Pivot Column".

     

    Select "Valor sum".

     

    Finally, select "Close & Apply".

     

    Here is the result.

     

    Regards,

    Nono Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    For your question, here is the method I provided:

     

    Here's some dummy data

     

    Load data into PowerBI.

     

    Use Power Query to convert the data.

     

    Click on the "Mes" column and in the Transform tab click on "Pivot Column".

     

    Select "Valor sum".

     

    Finally, select "Close & Apply".

     

    Here is the result.

     

    Regards,

    Nono Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    Hi,
    Try this M code

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnXyDFHSUXLLzEvMS85MzAGyvRLzShOLKoEsAz1DCyOlWB2sytxSk4oQ6szMwOp8UtPBkjAa2SwLS7ASzxCFgKL8rNTkEqAo2FQkRThUoNhlZGxhohQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Title = _t, Area = _t, Month = _t, Value = _t]),
        RemoveColumns= Table.SelectColumns(Source,{"Title"}),
        RemoveDuplicates = Table.Distinct(RemoveColumns),
        AddIndex = Table.AddIndexColumn(RemoveDuplicates, "IndexTitle", 1, 1, Int64.Type),
        Merged = Table.Join(Source,"Title",AddIndex,"Title"),
        NewStep=Source,
         RemoveColumns2 = Table.SelectColumns(NewStep,{"Month"}),
        RemoveDuplicates2 = Table.Distinct( RemoveColumns2),
        AddIndex2 = Table.AddIndexColumn(RemoveDuplicates2, "IndexMonth", 1, 1, Int64.Type),
        Merged2 = Table.Join(Merged,"Month",AddIndex2,"Month")
    in
        Merged2

    And after Order Month by IndexMonth and Title by Index Title using this option:


    The final result should be this: