Forum Discussion

semidevil's avatar
semidevil
Icon for Helper I rankHelper I
8 years ago
Solved

How do I create a column that sums from the same row

Maybe I'm missing something, but I want to create a column that sums 2 cells in the same row.  Something very similar to excel where column C1 = A1 + B1, C2 = A2 + B2, etc etc

 

I used SUMX but the new column is populated with the same number for the entire column (appears to be the grand total of all rows and columns combined)

 

Net = SUMX(Table1, Col1[cost] + Col2[gain])
  • Hi, are you putting this column into a calculated column or a measure?

    If you are putting it in a measure, you will get the total of the sum of the two columns in the row context which depends on the granularity of your visual. So

        Net := SUMX(Table1, Col1[cost] + Col2[gain])

    Will work.

     

    If you are putting it into a calculated column then just write 

        Net = Col1[cost] + Col2[gain]

     

    (The convention is "measure := ..." or "calculated column = ...")

1 Reply

  • RobertSlattery's avatar
    RobertSlattery
    Icon for Responsive Resident rankResponsive Resident

    Hi, are you putting this column into a calculated column or a measure?

    If you are putting it in a measure, you will get the total of the sum of the two columns in the row context which depends on the granularity of your visual. So

        Net := SUMX(Table1, Col1[cost] + Col2[gain])

    Will work.

     

    If you are putting it into a calculated column then just write 

        Net = Col1[cost] + Col2[gain]

     

    (The convention is "measure := ..." or "calculated column = ...")