Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Njoerd
Frequent Visitor

sum last value of each year

Hej,

 

i can't figure out how to solve this problem. I have data similiar to this:

DateIDVALUE
01.03.2022100900
01.06.20221001200
31.12.2023100800
01.03.2022200500
01.06.2022200600
31.12.2023200500

 

I would like to achieve the following.

I need the totals of the latest value of each year per category summed up.

IDTotal Value
1002000
2001100

 

I am able to calculate the values and place them in a matrix, which shows the outcome i need per year:

 

 

LastPlanValueYear = 
var LastPlanDate = MAXX(TABLE, TABLE[Date])

return
CALCULATE(
    SUM(TABLE[Value]),
    Filter('TABLE', TABLE[Date] = LastPlanDate)
)

 

 

Matrix:

ID20222023Total
1001200800800
200600500500

 

I can't figure out how to get the totals right, and i need them as calculated measure for each ID. The matrix is just for demonstration purposes. Thanks for your help.

1 ACCEPTED SOLUTION
DimaMD
Solution Sage
Solution Sage

Hi @Njoerd  if you have a date table try this

 

Total = 
IF( HASONEVALUE(Dates[Year]),
[LastPlanValueYear],
SUMX( VALUES('Dates'[Year]),
[LastPlanValueYear]))

Screenshot_4.jpg

 

 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

2 REPLIES 2
DimaMD
Solution Sage
Solution Sage

Hi @Njoerd  if you have a date table try this

 

Total = 
IF( HASONEVALUE(Dates[Year]),
[LastPlanValueYear],
SUMX( VALUES('Dates'[Year]),
[LastPlanValueYear]))

Screenshot_4.jpg

 

 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
Njoerd
Frequent Visitor

Great!
I get what this code does but would have never figured this out by myself. Thanks a lot!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.