Forum Discussion

dkay84_PowerBI's avatar
dkay84_PowerBI
Icon for Microsoft Employee rankMicrosoft Employee
8 years ago
Solved

Power Query Help

I have a table (sample below) where the "Spend Year" columns can vary in number.  I need to TRANSFORM these "Spend Year" columns by dividing them by the value in the "Count" column.  This needs to be...
  • dkay84_PowerBI's avatar
    8 years ago

    Solved:

     

    Table.FromRecords(Table.TransformRows(#"Pivoted Column", (row) => 
            let
                Count = row[Count],
                OtherColumns = List.RemoveItems(Record.FieldNames(row), {"Account", "Billed Month"}),
                Transforms = List.Transform(OtherColumns, (name) => { name, (cell) => cell / Count})
            in
                Record.TransformFields(row, Transforms)))