# Power BI Measure - calculate on two columns in same table



## M1donne (Jan 27, 2017)

Hi there

I'm trying to create a measure using two columns in the same table..

I'm trying to sum two columns

Total days = sum(Table1[Metric]+Table1[Metric2])

However I'm getting the following DAX message...
_
The SUM function only accepts a column reference as an argument.

_I'm new to PowerBi and Dax - can someone please point me in the right direction?

Much appreciated

Md


----------



## barjoman (Jan 27, 2017)

SUM can only take one column at a time, so you have to use:

Total Days:=SUM(Table1[Metric])+SUM(Table1[Metric2])


----------



## M1donne (Jan 27, 2017)

Thank you

I'm still getting the same error message, even when I use multiple sums as below

Total Days = SUM(Table1[Metric]) + SUM(Table1[Metric2])

I'm confused - could it be due to both Metric and Metric 2 are Sigma calculations?

regards


----------



## barjoman (Jan 27, 2017)

What do you mean by:


M1donne said:


> could it be due to both Metric and Metric 2 are Sigma calculations?



Are [Metric] and [Metric2] columns or measures? If they are measures, then you do not need to refer to Table1 or use SUM:
Total Days:=[Metric]+[Metric2]


----------



## M1donne (Jan 27, 2017)

Hi there

They are both columns, the Sigma sign to the right of the column name (in the fields section of the screen) - can you please confirm what that means?

I appreciate your help


----------



## barjoman (Jan 27, 2017)

M1donne said:


> Hi there
> 
> They are both columns, the Sigma sign to the right of the column name (in the fields section of the screen) - can you please confirm what that means?
> 
> I appreciate your help



Alright, so if it has a sigma sign next to the field in the PivotTable field list, then it is a measure, not a column. You cannot use it in a SUM function. If you want to add them together, just use [Metric]+[Metric2]. You'll want to be sure you know what the measures are doing so that you get the expected result.

I'm assuming you didn't create the measure yourself. There are 2 ways to see what the measure is doing:

1. If you are in the Excel Window --> Power Pivot ribbon --> Measures --> Manage Measures. Then choose the measure you want to see and hit edit. That will show you the DAX code behind the measure and allow you to edit it.
2. If you are in the Power Pivot Window, then go to the table where the measure is located (under whichever table it appears in your pivot table field list) and search for it in the grid which appears beneath the table with values. You can then click on it to view and double click to edit just like you would an Excel formula.

Hope this makes sense.


----------



## M1donne (Jan 27, 2017)

Thank you so much - my understanding of the Measure was it had a 'Calculator' Icon against it as opposed to a Sigma sign - that makes much more sense.

Much appreciated - having dabbled in Power Pivot, this is so much better.


----------



## M1donne (Jan 27, 2017)

I'm working in Power BI as opposed to Power Pivot - does that matter re checking the Measure code?


----------



## barjoman (Jan 27, 2017)

Sorry. I didn't see the PowerBI part of the thread title. I believe if you click on the measure in the field list, you can view the formula in the formula bar. 

With respect to the calculator icon vs sigma icon, I'm not 100% sure but I believe the calculator is for a calculated column rather than a measure. But don't quote me on it.


----------

