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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Formula to sum (Same Category but previous Version's Amount) Values

hi,

I am trying to find a formula for "Test Result" column, which should be like "Wanted Result" column

Attached is the screenshot and PBIX file.

I have the formula so far like 

Test Result = if([Version#] <= 2,0,
CALCULATE ( SUM ( [Value] ),
filter ( Test, [Category]=[Category] && [Line#] = [Line#] && value([Version#]) < [Version#]-1)
))

 

https://drive.google.com/file/d/1L-5bHbdlweGYaQFwSuFZqWO_wWmfbMFx/view?usp=sharing
https://drive.google.com/file/d/1SimBnxRbvKi00USgHYVngRHRM0s9Lr02/view?usp=sharing

Will appreciate help in fixing it, so "Test Result" is exactly same results as "Wanted Results" ?
thank you in advance

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous 

Not sure if I have it right, I get different results than your wanted result for some lines but I think it is what you are looking for.

Result =
VAR _Line = Test[Line#]
VAR _Ver = Test[Version#]
RETURN
    CALCULATE (
        SUM ( Test[Value] ),
        ALLEXCEPT ( Test, Test[Category] ),
        Test[Line#] = _Line,
        Test[Version#] < _Ver
    )

PrevVersAmounts.jpg

If this solves your issues please mark it as the solution so that others can find it easily. Kudos 👍 are nice too.
John

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@Anonymous 

Not sure if I have it right, I get different results than your wanted result for some lines but I think it is what you are looking for.

Result =
VAR _Line = Test[Line#]
VAR _Ver = Test[Version#]
RETURN
    CALCULATE (
        SUM ( Test[Value] ),
        ALLEXCEPT ( Test, Test[Category] ),
        Test[Line#] = _Line,
        Test[Version#] < _Ver
    )

PrevVersAmounts.jpg

If this solves your issues please mark it as the solution so that others can find it easily. Kudos 👍 are nice too.
John

Anonymous
Not applicable

Thank you JDBuchanan. 

You Rock ! 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.