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
Analitika
Post Prodigy
Post Prodigy

Calculate sum according to last date in Power BI

Hi,

 

I would like to ask how calculate sum which depends on last date. date=last column date?

13 REPLIES 13
NikhilChenna
Skilled Sharer
Skilled Sharer

Hi @Analitika ,

I think you can acheive this by using the below,

 

Measure a = 
var lastdate = MAX('table1'[date])

RETURN

CALCULATE(
SUM('table1'[abc],
FILTER('table1','table1'[date]= lastdate)
)

Try this change the tables and columns as per your table names. this will work.

 

 

Regards, 
Nikhil Chenna 


Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

Yeah, I tried this but I am getting 0 instead of 1. So it is wrong.

Hi @Analitika ,


Try to return only lastdate first, and check if you are getting the lastdate and then return the Calculate part. 

 

Regards, 
Nikhil Chenna 


Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

Analitika_0-1674459148412.png

Seems last date ok, but still it summing all values in column so it is wrong.

Hi @Analitika ,

Sorry i got it know you can use the below to acheive your solution,

 

1. for eg. Create a measure for getting the sum of a column as below

total

SUM('table1'[abc])

 

2. Create a another measure for getting the sum for last date, 

Sumforlastdate = 
CALCULATE(
SUM('table1'[abc]),
LASTNONBLANK( 'Date'[date], total )
)

 

This will work, i have checked it.

 

Regards, 
Nikhil Chenna 


Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

I have tried but still getting 0.

pratyashasamal
Memorable Member
Memorable Member

Hi @Analitika ,
Please try this calculation :-
Last Date Amount =
CALCULATE (
SUM ( Table[Amount] ),
TOPN ( 1, VALUES ( Table[Date] ), Table[Date], DESC )
)
OR 

 CALCULATE( SUM(Table[Amount]) , 'Date'[Date] = Table[LastUpdateDate] )


Thanks,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





I am getting 0 with formula: Last Date Amount =
CALCULATE (
SUM ( Table[Amount] ),
TOPN ( 1, VALUES ( Table[Date] ), Table[Date], DESC )
)

Hi @Analitika ,
Please try this calculation as well .
 CALCULATESUM(Table[Amount]) , 'Date'[Date] = MAX( 'Date'[Date]))

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





nothing changed

Hi @Analitika ,
Can you please share a sample dataset to try on .
Thanks ,
Pratyasha Samal





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @Analitika ,
You can also try this 

Measure 2 = CALCULATE (
SUM ( Orders[Sales] ),
FILTER(Orders , Orders[Order Date] = Orders[Max date])
)
Max date = CALCULATE( MAX( Orders[Order Date]) , ALL(Orders))
Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





not working

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors