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
KLJ
Helper I
Helper I

Calculate the sum of the line amounts with the highest version number

Hi

 

I need to calculate the sum af the line amount but only on the rows where the version numner is the highest.

for order# 1 calculate the sum of line amount where version# is 2

for order# 2 calculate the sum of line amount where version# is 4

and so on.

The Version no is not static.It can change when I update the data.

 

Hope someone can help

 

My data look like this (very simplefied)

 

Order NOVersion NOItem NOLine amount
1110                 5,00
1111                 9,00
1112                 7,00
1210                 5,00
1211                 9,00
1212                 7,00
2125                 7,00
2137                 4,00
2144                 8,00
2199                 4,00
2225                 7,00
2237                 4,00
2244                 8,00
2299                 4,00
2325                 7,00
2337                 4,00
2344                 8,00
2399                 4,00
2425                 7,00
2437                 4,00
2444                 8,00
2499                 4,00
3166                 9,00
1 ACCEPTED SOLUTION
LarsSchreiber
Responsive Resident
Responsive Resident

Hi @KLJ,

 

try this:

 

MSumMaxVersionNO :=
CALCULATE (
    SUM ( [Line amount] );
    FILTER ( Tabelle1; Tabelle1[Version NO] = MAX ( Tabelle1[Version NO] ) )
)

Regards,

Lars

View solution in original post

3 REPLIES 3
LarsSchreiber
Responsive Resident
Responsive Resident

Hi @KLJ,

 

try this:

 

MSumMaxVersionNO :=
CALCULATE (
    SUM ( [Line amount] );
    FILTER ( Tabelle1; Tabelle1[Version NO] = MAX ( Tabelle1[Version NO] ) )
)

Regards,

Lars

- edited - This is not working correct I will reply later with the solution I proposed

 

@KLJ  If you need to use it without putting Orders in graph you can wrap  @LarsSchreiber  formula in a SUMX .

 

 

MSumMaxVersionNO  2 :=

VAR maxversion =
    CALCULATE (
        SUM ( Table1[Line amount] );
        FILTER ( Table1; Table1[Version NO] = MAX ( Table1[Version NO] ) )
    )
RETURN
    SUMX ( VALUES ( Table1[Order NO] ); maxversion )

 

Konstantinos Ioannou

Hi Lars

 

Thank you. that did it Smiley Happy

 

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.

Top Solution Authors