Transform a table in Power Query

Aleksei Talanov 1 Reputation point
2021-03-24T12:13:13.437+00:00

Hi, I have a specific situation, I need transfer a table: I have a table in one format, but I need to transform it into another one81185-snip20210324-8.png

Community Center Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Matteo Agostini 11 Reputation points
    2021-04-17T10:36:41.97+00:00

    Dear Aleksei,

    before answering to you I made some hypothesis because like Ehren underlined it's not possible to answer you with just that screenshot.

    I assumed that you have a list like this:
    88755-aleksei-1.png

    If you select column "Attribute" >>> Transform >>> Pivot Column >>> Select "Value" and in Advance options "Don't Aggregate" you'll get the following result:
    88679-aleksei-2.png

    So you must change the data source in a way similar to the following picture if you want to reach your goal:
    88772-aleksei-3.png

    Now again, if you select column "Attribute" >>> Transform >>> Pivot Column >>> Select "Value" and in Advance options "Don't Aggregate" you'll get the following result:88720-aleksei-4.png

    Here you can find the advanced editor detail:

    let  
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcvYM03UJctc1MDAwVNJR8nQLApKOSrE62KSMgJQTDjljIOWMQ84ESLlgl3MGkgYGOORMQZKG6JJGuN1phMedRnjsM8ZtpDGKtlgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Doc_Nr = _t, Attribute = _t, Value = _t]),  
        #"Changed Type" = Table.TransformColumnTypes(Source,{<!-- -->{"Doc_Nr", type text}}),  
        #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Attribute]), "Attribute", "Value"),  
        #"Replaced Value" = Table.ReplaceValue(#"Pivoted Column",null,"-",Replacer.ReplaceValue,{"IFR", "IFR2", "IFR3", "IFR4", "IFC", "IFC5"})  
    in  
        #"Replaced Value"  
    

    After you can create a table and change the name column:
    88695-aleksei-5.png

    Here you can download a copy of the pbix file.

    I hope that could be useful
    Have a nice day
    Matteo

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.