Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Calculate Function Not Summing Correctly

Hello,   I have a pretty simple formula below that I want the sum to calculate based off the two criteria I have put in the filter. It seems that the sum is only taking into account the first filte...
  • Greg_Deckler's avatar
    2 years ago

    Anonymous Looks like you have a single table involved in your calculation. CALCULATE is not really good with dealing with just single tables. I would advise a No CALCULATE approach:

    2018 Employees =
      VAR __2018LastModifiedDate = [2018 Last Modified Date]
      VAR __LatestDate2018 = [Latest Date 2018]
      VAR __Table = FILTER(ALLSELECTED('SQL'),'SQL'[attributes.lastModifiedDate] = __2018LastModifiedDate  && 'SQL'[attributes.periodEnd] = __LatestDate2018 ))
      VAR __Return = SUMX(__Table, [attributes.value])
    RETURN
      __Return