I have a table which contains a row for each day and number of hours an employee is employed.
Table 1
Employee Task Hours Date Sum (what I'm looking for)
A 123 4 1/1/2017 8
A 403 4 1/1/2017 8
B 123 3 1/1/2017 8
B 656 5 1/1/2017 8
A 303 1 1/2/2017 7
A 123 6 1/2/2017 7
What I am trying to do is take the sum of the Hours column grouped by Date. In other words, I want the sum of the Hours column where the Date = Date in the current row.
What you need is the EARLIER function.
The DAX for the calculated column is as follows:
Sum =
CALCULATE(
SUM(Table1[Hours]),
FILTER(
ALL(Table1) ,
Table1[Employee] = EARLIER(Table1[Employee]) &&
Table1[Date] = EARLIER(Table1[Date])
)
)
Result:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With