Forum Discussion

Felipe's avatar
Felipe
New Member
10 years ago
Solved

I need help add 2 columns

Gentlemen,

Has a column that I need to add and place the value in another column, wanted to use the SUMX, anyone know the syntax? Can someone help me?

2 Replies

  • kcantor's avatar
    kcantor
    Community Champion

    If you have a column called Sales and another called Bonus Sales in your sales table you would add them by using =SUM('SalesTable'[Sales]+[Bonus Sales])

    Simple and easy to create a calculate column. You can even just use the column names: =[Sales]+[Bonus Sales] if you want to. I think you must be asking something more specific like how to add across specific row filters but am not sure until you specify.

     

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Syntax for SUMX can be found here:

    https://support.office.com/en-US/article/SUMX-Function-DAX-9ca68d1f-34cd-4a98-bc5c-36646118811a

     

    Basically, the first parameter is a filter and then the next is your expression.

     

    For example, SUMX(ALL(Table1),[Column1])

     

    This will sum all Column1 for all rows in Table1 regardless of any context filters like slicers, etc. Note that this is the equivalent of SUM([Column1]) AS LONG AS THERE ARE NO CONTEXT FILTERS!! If you want to use context filters, use SUM, otherwise, use something like SUMX.

     

    You can use any filter function in the first parameter. Filter functions can be found here:

    https://support.office.com/en-US/article/Filter-Functions-DAX-9beae5b1-7a2f-495e-a205-c3b8f3724362