Forum Discussion

Davidian's avatar
Davidian
Regular Visitor
2 years ago
Solved

Measure not filtering correctly (But sometimes does)

I have 2 dropdowns 1 is filled with dates, from a dates table that filters the tables for the tables - however, some of the tables are not filtered by date so is not joined. There is a measure on t...
  • Greg_Deckler's avatar
    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
      __Result

    Yet another reason to not use CALCULATE...