Forum Discussion
Calculate Function Not Summing Correctly
- 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
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
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_Deckler2 years agoCommunity 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?
- Anonymous2 years agoNot applicable
Hey Greg_Deckler ,
Please see the below images:
3 + 1 + 242 + 115 + 331 + 1 + 17 + 1 + 1 + 348 + 101 = 1,161
P.S. - 1,161 is the correct total I am expecting to see, but it isn't summing it at the asset row.
Instead it is showing the below photo:
- Greg_Deckler2 years agoCommunity Champion
Anonymous First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8Also, this specifically may help as well: Matrix Measure Total Triple Threat Rock & Roll - Microsoft Fabric Community