Forum Discussion

KassemEl's avatar
KassemEl
Frequent Visitor
6 years ago
Solved

Add All Columns Except One

I have an updating database and I need a new column that displays the sum of the existing tables as well as the new columns that appear.    As an example   Currently    1 | 2 | Name            ...
  • fhill's avatar
    fhill
    6 years ago

    Since new columns will be added all the time, you don't have a true table, but a Pivoted data set.  Start by UnPiviotOtherColumns.  This will take ALL Other Columns but the one(s) specified and convert them into 'Attribute' (Column Name) and 'Value' (Number Value previously in each column).

     

    Once done, you can create a simple Table of 'Name' and SUM 'Value' to sum ALL columns other than Name even if the raw input changes.  *** I couldn't get this working testing with .csv files, but I think that was because of 'type' of the new columns wasn't being defined.  I hope with your real data source you might have better luck... ***

     

    = Table.UnpivotOtherColumns(#"Changed Type", {" Name"}, "Attribute", "Value")