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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Shreekant
Regular Visitor

Method to sum based on max value in another column

Hello there,

I need help in with a method to achieve the results I need for the following 'Policy' table:

I have already filtered policies by date filters(Year/Month), then I want to calculate sum of the 'Amount' for the listed policies where revision is highest for the 'policy_Number'. 

YearMonthDayPolicy_NumberRevisionAmount
2019January7P17262$0
2019January11P17263$22,802
2019January28P17264$22,802
2019January7P19133$3,823
2019January23P0022750$110,276

 

The expected result should be $136,901 becuase I want to sum 'Amount' of the following policies as their revisions are highest 

 

2019January28P17264$22,802
2019January7P19133$3,823
2019January23P0022750$110,276

 

Thanks for the help in advance!

2 REPLIES 2
amitchandak
Super User
Super User

Try Something like

 

Measure = 
VAR __id = MAX ( 'Table'[Policy_Number] )
VAR __date = CALCULATE ( MAX( 'Table'[Date] ), ALLSELECTED ( 'Table' ),  'Table'[Policy_Number] = __id ) 
RETURN CALCULATE ( sum ( 'Table'[Amount] ), VALUES ( 'Table'[Month-Year] ), 'Table'[id] = __id, 'Table'[date] = __date )

Thanks @amitchandak for your reply.

 

This method won't help as I need to get the result based on the latest 'Revision' for a given 'Policy_Number' and then sum all policies 'Amount' Could you please suggest an alternate method. 

 

Thanks. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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