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
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
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.