Forum Discussion
Anonymous
3 years agoNot applicable
I need help understanding this dax code and the functions used in it. Calculate, filter.
I was tasked to make some python visualizations with this dax code: Inclusion_Expected =
VAR _item_number = Source_With_Trace_ID[Item_Number]
VAR _cast_date = Source_With_Trace_ID[Casting...
Greg_Deckler
Community Champion
3 years agoAnonymous It is doing something because of how CALCULATE replaces filtering context and the fact that you are operating essentially in the context of ALL when you are doing those CALCULATE statements. The variables at the beginning are just preserving the row context that you want to use later. You can think of the first CALCULATE statement like the following:
SUMX(
FILTER(
ALL('Source_With_Trace_ID'),
[Item_Number] = _item_number
&& [Casting_Date] >= _start_date
&& [Casting_Date] < _cast_date
),
[Inclusion]
)