Depending on the execution, the following query will return different values:
DEFINE
VAR _state_id = 11685
MEASURE accumulators[total_distance_when_number_of_copies_is_1] =
CALCULATE(
SUM( 'order_details'[distance] )
, TREATAS(
CALCULATETABLE(
SUMMARIZE(
'order'
, 'order'[city_id]
, 'order'[customer_id]
)
, 'order'[number_of_copies] = 1
)
, 'order_details'[city_id]
, 'order_details'[customer_id]
)
)
MEASURE accumulators[total_distance_when_number_of_copies_is_2] =
CALCULATE(
SUM( 'order_details'[distance] )
, TREATAS(
CALCULATETABLE(
SUMMARIZE(
'order'
, 'order'[city_id]
, 'order'[customer_id]
)
, 'order'[number_of_copies] = 2
)
, 'order_details'[city_id]
, 'order_details'[customer_id]
)
)
VAR _accumulators = CALCULATETABLE(
SUMMARIZECOLUMNS(
state[id]
, "total_distance_when_number_of_copies_is_1", [total_distance_when_number_of_copies_is_1]
, "total_distance_when_number_of_copies_is_2", [total_distance_when_number_of_copies_is_2]
)
, state[id] = _state_id
)
EVALUATE _accumulators
If we hit F5 several times this is the result:
As can be seen, the values on the third column sometimes are the same to the ones on the second.
We are running Analysis Services 2019 15.0.32.50 using a tabular model.
It's worth to mention that this is something that doesn't happen on Analysis Services 2017, if we used the same script and backup file, the results for this same query will always be the same no matter how many times we execute it.
Here is the database backup file used in this example: ssas.abf