scottsen
Well-known Member
- Joined
- Mar 16, 2014
- Messages
- 1,263
Hi Folks! My turn for a question
I would like to know if there is a consistent/knowable criteria for evaluating the order which filters get applied.
Example...
We have some base measure for "opportunity revenue" that calculates the revenue for all customers... That meet some criteria which is "date-sensitive". It is grabbing the last date in the filter context and using it to do a lookup in a profitability table to grab a [ProfitBucket] value... if that is "0" they are an "opportunity".
However, if I now (naively?) write a measure that uses that base measure:
It becomes... confusing.
Is the Calendar[Date] referred to in the base measure, the original filter context, or the one modified by the FILTER() in my 2nd measure?
or...
Is the Calendar[KW ID] referred to in the 2nd measure, or original filter context, or the one modified by the LASTDATE() in the 1st measure?
[Note: This was probably a dumb example cuz it might accidentally work... I should have used a PriorYear related measure, but I'm too lazy to fix it now, and the question is still valid'ish ]
I would like to know if there is a consistent/knowable criteria for evaluating the order which filters get applied.
Example...
We have some base measure for "opportunity revenue" that calculates the revenue for all customers... That meet some criteria which is "date-sensitive". It is grabbing the last date in the filter context and using it to do a lookup in a profitability table to grab a [ProfitBucket] value... if that is "0" they are an "opportunity".
Code:
Opportunity_Revenue :=
CALCULATE (
[Revenue],
FILTER (
Customers,
CALCULATE (
VALUES ( Profitability[ProfitBucket] ),
[COLOR="#FF0000"] LASTDATE ( Calendar[Date] )[/COLOR]
) = 0
)
)
However, if I now (naively?) write a measure that uses that base measure:
Code:
Opportunity_Revenue_YTD :=
CALCULATE (
[[B]Opportunity_Revenue[/B]],
VALUES ( Calendar[Year] ),
FILTER (
ALL ( Calendar ),
Calendar[KW ID] <= [COLOR="#FF0000"]MAX ( Calendar[KW ID] )[/COLOR]
&& Calendar[KW ID] >= [First Week Id]
)
)
It becomes... confusing.
Is the Calendar[Date] referred to in the base measure, the original filter context, or the one modified by the FILTER() in my 2nd measure?
or...
Is the Calendar[KW ID] referred to in the 2nd measure, or original filter context, or the one modified by the LASTDATE() in the 1st measure?
[Note: This was probably a dumb example cuz it might accidentally work... I should have used a PriorYear related measure, but I'm too lazy to fix it now, and the question is still valid'ish ]