Search code examples
powerbipowerquerypowerbi-desktop

Data mapping / melting in power BI


i have the table enter image description here

i want my data in this way

Attribute value 301 under 10, 10 - 12 , 12 -13 401 ...........

such that only the first three digit are the attribute e.g 301 and identical attributes e.g 301,3011,3012 are mapped together with thier values. similarly 401 have value 401,4012,4014,...


Solution

  • let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Trim = Table.TransformColumns(Source,{{"Attribute", each Text.Start(Text.From(_),3), type text}}),
    #"Grouped Rows" = Table.Group(Trim, {"Attribute"}, {{"Value", each Text.Combine([Value],"//")}})
    in  #"Grouped Rows"
    

    enter image description here