Forum Discussion

pect's avatar
pect
Helper I
8 years ago
Solved

Table transformation

Dear all,   I would like to transform a table in Power BI but I don't find the way to do it. I will clarify my doubt with an example.   1) I load in Power BI  a table like the following:   ...
  • MarcelBeug's avatar
    MarcelBeug
    8 years ago

    This query:

     

    let
        Source = Table1,
        #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Project"}, "Attribute", "Value"),
        #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "Recruitment status"}, {"Value", "Amount"}}),
        #"Inserted Text After Delimiter" = Table.AddColumn(#"Renamed Columns", "Year", each Text.AfterDelimiter([Recruitment status], " ", {0, RelativePosition.FromEnd}), type text),
        #"Extracted Text Before Delimiter" = Table.TransformColumns(#"Inserted Text After Delimiter", {{"Recruitment status", each Text.BeforeDelimiter(_, " ", 0), type text}}),
        #"Reordered Columns" = Table.ReorderColumns(#"Extracted Text Before Delimiter",{"Project", "Recruitment status", "Year", "Amount"})
    in
        #"Reordered Columns"

     

    Results in: