Forum Discussion
Calculating Total Balances
- 9 years ago
Hi tespinal,
In the resource data, there are multiple transaction in one day. But the time is different, so you want to get the lasted transaction and sum them, right? If it is, I try to reproduce using the sample data.
Then create a measure using the following formula.
Result = CALCULATE(SUM(Table1[BALANCE]),FILTER(Table1,Table1[DATE]=CALCULATE(MAX(Table1[DATE]),ALLEXCEPT(Table1,Table1[ID]))))
Create a card used to display the result, please see the following screenshot, it returns the expected result.
Best Regards,
Angelia
Hi tespinal, are you writing this as a measure or a calculated column?
I'm trying to write it as a measure so I can display it on a card visual.
- Phil_Seamark9 years agoMicrosoft Employee
I think I managed to get it working using the following formula.
Latest Balance = CALCULATE(SUM('Table'[BALANCE]),LASTNONBLANK('Table'[DATE],1))
I used a Multi Row Card with just [ID] and [Latest Balance] in the fields.
I also adjusted your data. For [ID] 1 & 3 you had two values with the same date. So I adjusted 1 to be earlier.
- tespinal9 years agoFrequent Visitor
I appreciate the feedback, but the results from the formula same as the ones I got from my original formula. The balances may have the same date because they can change throughout the day, like a checking account. It's like if I have 3 checking accounts and I do multiple transactions throughout the day, I am looking to get the sum of all 3 account balances as of right now.
- v-huizhn-msft9 years agoMicrosoft Employee
Hi tespinal,
In the resource data, there are multiple transaction in one day. But the time is different, so you want to get the lasted transaction and sum them, right? If it is, I try to reproduce using the sample data.
Then create a measure using the following formula.
Result = CALCULATE(SUM(Table1[BALANCE]),FILTER(Table1,Table1[DATE]=CALCULATE(MAX(Table1[DATE]),ALLEXCEPT(Table1,Table1[ID]))))
Create a card used to display the result, please see the following screenshot, it returns the expected result.
Best Regards,
Angelia