SUM and ACCUMULATE?
%_sum_value = SUM(table[value])
%_accumulate_value =
CALCULATE(
SUM('table'[value]),
FILTER(
ALL(table),
table[date_time] <= MAX(table[date_time])
)
)
The main difference between %_sum_value
and %_accumulate_value
is that the former calculates the sum of the value
column in the table
table, while the latter calculates the accumulated total of the value
column up to the maximum date in the date_time
column of the table
table.
Specifically:
%_sum_value
uses the SUM
function to calculate the sum of the value
column in the table
table. This formula does not apply any filters or conditions to the data and simply returns the total sum of all values in the column.
%_accumulate_value
uses the CALCULATE
function to apply a filter to the value
column in the table
table based on the maximum date in the date_time
column. The FILTER
function is used to remove any filters on the table
table, and then apply a filter to select only the rows where the date_time
column is less than or equal to the maximum value in the column. This filtered subset of rows is then passed to SUM
, which calculates the accumulated total of the value
column up to the maximum date in the date_time
column.
In summary, %_sum_value
calculates the total sum of the value
column, while %_accumulate_value
calculates the accumulated total of the value
column up to a specific date. The latter formula applies a filter to the data based on the maximum date in the date_time
column before calculating the accumulated total.