Forum Discussion
Combining Cumulative measure from different datasets
- 1 year ago
Adrian88 To create a total cumulative measure that combines both material and labour costs into a single line, you need to ensure that the calculation considers both datasets correctly and accumulates the values over time.
DAX
Cumulative Material Cost =
VAR _MaxDate = MAX('LATIS Material Data'[G/L Date])
RETURN
CALCULATE(
SUM('LATIS Material Data'[Amount]),
ALLSELECTED('LATIS Material Data'),
'LATIS Material Data'[G/L Date] <= _MaxDate
)DAX
Cumulative Labour Cost =
VAR _MaxDate = MAX('Timesheet Data Sept2020-2023'[Date])
RETURN
CALCULATE(
SUM('Timesheet Data Sept2020-2023'[Amount]),
ALLSELECTED('Timesheet Data Sept2020-2023'),
'Timesheet Data Sept2020-2023'[Date] <= _MaxDate
)DAX
Combined Cumulative Cost =
VAR _MaxDate = MAX(Dates[Master Date])
RETURN
CALCULATE(
[Cumulative Material Cost] + [Cumulative Labour Cost],
ALLSELECTED(Dates),
Dates[Master Date] <= _MaxDate
)
Adrian88 To create a total cumulative measure that combines both material and labour costs into a single line, you need to ensure that the calculation considers both datasets correctly and accumulates the values over time.
DAX
Cumulative Material Cost =
VAR _MaxDate = MAX('LATIS Material Data'[G/L Date])
RETURN
CALCULATE(
SUM('LATIS Material Data'[Amount]),
ALLSELECTED('LATIS Material Data'),
'LATIS Material Data'[G/L Date] <= _MaxDate
)
DAX
Cumulative Labour Cost =
VAR _MaxDate = MAX('Timesheet Data Sept2020-2023'[Date])
RETURN
CALCULATE(
SUM('Timesheet Data Sept2020-2023'[Amount]),
ALLSELECTED('Timesheet Data Sept2020-2023'),
'Timesheet Data Sept2020-2023'[Date] <= _MaxDate
)
DAX
Combined Cumulative Cost =
VAR _MaxDate = MAX(Dates[Master Date])
RETURN
CALCULATE(
[Cumulative Material Cost] + [Cumulative Labour Cost],
ALLSELECTED(Dates),
Dates[Master Date] <= _MaxDate
)
Thanks bhanu_gautam , that does seem to have worked, I thought I had already tried something very similar but there must have been a subtle difference.