Forum Discussion
Measure not filtering correctly (But sometimes does)
- 2 years ago
Davidian Using measures in the filter clause of a CALCULATE can do wacky things. I generally use VAR statements to do this instead so something like.
LiabilitySumWithFilter = VAR __FLDateBeforeDate = [FLDate Before Date] VAR __SelectedPortfolioFulcrumEntityId = [SelectedPortfolioFulcrumEntityId] VAR __Result = CALCULATE(SUM(FundingLevel[LiabilityValue]), FILTER(FundingLevel,FundingLevel[Date]=__FLDateBeforeDate &&FundingLevel[Portfolio_FulcrumEntityId]=__SelectedPortfolioFulcrumEntityId )) RETURN __ResultYet another reason to not use CALCULATE...
Davidian Using measures in the filter clause of a CALCULATE can do wacky things. I generally use VAR statements to do this instead so something like.
LiabilitySumWithFilter =
VAR __FLDateBeforeDate = [FLDate Before Date]
VAR __SelectedPortfolioFulcrumEntityId = [SelectedPortfolioFulcrumEntityId]
VAR __Result =
CALCULATE(SUM(FundingLevel[LiabilityValue]), FILTER(FundingLevel,FundingLevel[Date]=__FLDateBeforeDate &&FundingLevel[Portfolio_FulcrumEntityId]=__SelectedPortfolioFulcrumEntityId ))
RETURN
__Result
Yet another reason to not use CALCULATE...
Good morning, hope you had a fantastic weekend.
Just wanted to say thanks again, I have started going through my formula replacing them with the methodology you mention and it seems to be working (the figures are correct like my "long winded" versions) so thank you so much for that.
Seems really strange measures operate that way - is this an "error" with Dax that one just has to accept and will likely never be fixed, or is it actually considered a "feature"? lol