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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.