Forum Discussion
zivhimmel
Resolver I
9 years agoCalculate SUM for latest dates
Hi, Here's what I'm trying to do, complete with data samples. Let's assume I have a "contributions" table, which looks like this: As you can see, a user can contribua...
- 9 years ago
Hi zivhimmel,
Based on my test, you should be able to use the formula below to create a new measure to calculate the sum of the latest contributions in your scenario. :smileyhappy:
sum of the latest contributions = SUMX ( SUMMARIZE ( contributions, contributions[User], "LatestContributions", CALCULATE ( SUM ( contributions[Contribution] ), FILTER ( contributions, contributions[DateID] = MAX ( contributions[DateID] ) ) ) ), [LatestContributions] )Regards
v-ljerr-msft
Microsoft Employee
9 years agoHi zivhimmel,
Based on my test, you should be able to use the formula below to create a new measure to calculate the sum of the latest contributions in your scenario. :smileyhappy:
sum of the latest contributions =
SUMX (
SUMMARIZE (
contributions,
contributions[User],
"LatestContributions", CALCULATE (
SUM ( contributions[Contribution] ),
FILTER ( contributions, contributions[DateID] = MAX ( contributions[DateID] ) )
)
),
[LatestContributions]
)
Regards
- zivhimmel9 years ago
Resolver I
v-ljerr-msft, this seems perfect.
As you can imagine, my real model is a bit reacher, so I'll try it tomorrow with real data and make sure it's working.
Thanks allot!
Update the next day: working very well. Thanks again.