# SUMX Over Multiple Columns



## cr731 (Apr 17, 2018)

I am using SUMX to sum a calculation by Order Number in my table, and I want to add a new calculation that iterates over both Order Number and Item Number in my table, but having trouble doing so.

My table looks something like


Date
Order Number
Item Number
Other Columns...
Sales
4/1/2018
789
ABC
...
100
4/1/2018
789
DEF
...
50


<tbody>

</tbody>
 My current formula is


```
SUMX( DISTINCT(Table[Order Number]), [MyMeasure] )
```

I'd like to have this calculation run over the combination of Order Number and Item Number.  I'd prefer to not have to create a calculated column concatenating Order Number and Item Number if possible.  I'm stuck because it seems like DISTINCT only takes a single column.

Thanks


----------



## gazpage (Apr 18, 2018)

```
SUMX (
    SUMMARIZE ( Table[Order Number], Table[Item Number]),
    [MyMeasure]
)
```


----------



## gazpage (Apr 18, 2018)

```
SUMX (
    SUMMARIZE ( Table, Table[Order Number], Table[Item Number]),
    [MyMeasure]
)
```


----------

