SUMIFS in DAX

Pingie

New Member
Joined
Nov 20, 2019
Messages
3
I want to add a column or measue that would do the same as the excel function:
sumifs(Net tons PY, [Column] Article,[Row in column Article] article number, [Column] Workcenter, [Row in colum workcenter] Workcenter).

Summarized: i need the tons based on the criteria that its suppose to be in de same article & workcenter.

I have been using DAX since a couple of weeks, so untill now i only know the SUM & DIVIDE function. I tried working with CALCULATE but was not able to get it working.

Does anyone know how i can make this work?


1575016204456.png
 

macfuller

Board Regular
Joined
Apr 30, 2014
Messages
242
CALCULATE is the correct command. I'm not sure if you want the IFs to be hardcoded or based on something else.

So, a simple example would be

[Tons PY] :=
CALCULATE (
SUM ( HKSIV[Net tons PY] ),
HKSIV[Article Descr] = "Tork XPN...",
HKSIV[Work center] = "Bretting 12",
...
)

If you're using slicers on the various columns then a simple SUM would be sufficient.
 

Pingie

New Member
Joined
Nov 20, 2019
Messages
3
Yes, but the lookup filter should be dynamic, so no specific reference to Tork XPN, or Bretting. In excel it will just refer to a cell that is not absolute. Will that work in Dax?
 

macfuller

Board Regular
Joined
Apr 30, 2014
Messages
242
At its simplest, the basic SUM measure for your PY Net Tons is dependent upon any filter or row context in your pivot table. So if you have a measure for [Tons PY] := SUM ( HKSIV[Net tons PY] ), then have slicers to pick any of the values from your other columns, or if you add the column (e.g. Article Descr) to the pivot table, the measure will automatically show you how many for that filter condition.
 

Forum statistics

Threads
1,077,783
Messages
5,336,304
Members
399,074
Latest member
rlong98

Some videos you may like

This Week's Hot Topics

Top