Forum Discussion
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 filter option. Is there something wrong with the below formula that could be causing this?
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
5 Replies
- Greg_DecklerCommunity Champion
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- AnonymousNot applicable
Hey Greg_Deckler ,
Thank you very much for the help. The meaure worked very well for all of my rows except one. It is showing an incorrect total for the row vs. what is in the underlying data. Do you know what could be casuing this?
- Greg_DecklerCommunity Champion
Anonymous Very tough to say. If it was showing something incorrect in the Total row, that would be one thing, is that what you are saying? Or is it an incorrect value in a row of a table?