Forum Discussion
kovan
4 years agoFrequent Visitor
Calculating Total Balances
hi community I am working on a project where I am trying to add the total balances of id numbers. In order to get this, I need to pull the last balance posted from our files from several id numbe...
kovan
4 years agoFrequent Visitor
this calculation is giving back Maximum balance for each id
tamerj1
4 years agoCommunity Champion
kovan
It shouldn't. Please make sure you are creatin a measure not a calculated column. To be more safe please use
Last balance =
VAR MaxDate =
MAX ( TableName[Date] )
RETURN
CALCULATE ( SELECTEDVALUE ( TableName[BALANCE] ), TableName[Date] = MaxDate )If you want to create a calculated column then
Last balance =
VAR IdTable =
CALCULATETABLE ( TableName, ALLEXCEPT ( TableName, TableName[ID] ) )
VAR MaxDate =
MAXX ( IdTable, TableName[Date] )
RETURN
MAXX ( FILTER ( TableName, TableName[Date] = MaxDate ), TableName[BALANCE] )