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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculate new value for max date of each month

Hi,

 

I want to calculate new column which will be the sum of all amounts for the max date of each month. Eg. In below data, 31st Jan is max date in 'Jan' month. Summation of all 31st Jan amount is '150'. I want to calculate 'New Amount' column. Would really appreciate of anyone can help me.

Thanks!

 

DateAmountNew Amount
1/29/2021  10150
1/30/2021  20150
1/30/2021  30150
1/31/2021  40150
1/31/2021  50150
1/31/2021  60150
2/2/2022  7090
2/3/2021  8090
2/10/2021  9090

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

 

you can create a column

Column = 
VAR _maxdate=maxx(FILTER('Table',YEAR('Table'[Date])=year(EARLIER('Table'[Date]))&&month('Table'[Date])=MONTH(EARLIER('Table'[Date]))),'Table'[Date])
return sumx(FILTER('Table','Table'[Date]=_maxdate),'Table'[Amount])

or create a measure

Measure = 
var _maxdate=maxx(FILTER(ALL('Table'),year('Table'[Date])=year(MAX('Table'[Date]))&&month('Table'[Date])=month(max('Table'[Date]))),'Table'[Date])
RETURN sumx(FILTER(ALL('Table'),'Table'[Date]=_maxdate),'Table'[Amount])

pls see the attachment below





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@Anonymous 

 

you can create a column

Column = 
VAR _maxdate=maxx(FILTER('Table',YEAR('Table'[Date])=year(EARLIER('Table'[Date]))&&month('Table'[Date])=MONTH(EARLIER('Table'[Date]))),'Table'[Date])
return sumx(FILTER('Table','Table'[Date]=_maxdate),'Table'[Amount])

or create a measure

Measure = 
var _maxdate=maxx(FILTER(ALL('Table'),year('Table'[Date])=year(MAX('Table'[Date]))&&month('Table'[Date])=month(max('Table'[Date]))),'Table'[Date])
RETURN sumx(FILTER(ALL('Table'),'Table'[Date]=_maxdate),'Table'[Amount])

pls see the attachment below





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

Proud to be a Super User!




sevenhills
Super User
Super User

Try this:

 

Latest Date In Month Amount = 

var _MM = Month(SELECTEDVALUE('Table'[Date]))
var _YYYY = year(SELECTEDVALUE('Table'[Date]))
var _MaxDateInMonth = CALCULATE( Max('Table'[Date]), FILTER( ALL('Table'),  Month('Table'[Date]) = _MM && Year('Table'[Date]) = _YYYY ))

RETURN SUMX(Filter(ALL('Table'), 'Table'[Date] = _MaxDateInMonth ), 'Table'[Amount])

 

Output:

sevenhills_1-1645575923406.png

Note: I added year also part of the logic.

Say, If you dont want the year and only month, use the below in which I removed the year. 

 

Latest Date In Month Amount 2 = 

var _MM = Month(SELECTEDVALUE('Table'[Date]))
var _MaxDateInMonth = CALCULATE( Max('Table'[Date]), FILTER( ALL('Table'),  Month('Table'[Date]) = _MM))

RETURN SUMX(Filter(ALL('Table'), 'Table'[Date] = _MaxDateInMonth ), 'Table'[Amount])

 

sevenhills_2-1645576166678.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors