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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JeanMariePBI
Helper I
Helper I

Calculated Column - cumulative sum using filter and ranked column

Hello,  I'm arelatively new to PBI and I need to create a calculated column that accumulates Net Sales based on the Products Price ranking (note multiple products appear in prod column).   The desired result is in the last column:

Product NumberProd Ranked by PriceNet PriceNet Sales(EXPECTED RESULT) Cumulative Revenue
Cat 1 $       7.00 $       7.00 $                       7.00
Cat 2 $       6.00 $       6.00 $                    13.00
Cat 3 $       5.00 $       5.00 $                    18.00
Cat 4 $       4.00 $       4.00 $                    22.00
Dog1 $       3.00 $       3.00 $                       3.00
Dog2 $       1.00 $       1.00 $                       4.00

 

 

My current DAX logic just returns the net sales value at each ranking and does not aggregate the sales.   Any help would be greatly appreciated.  Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JeanMariePBI ,

 

You could use ALLEXCEPT() funtion and EARLIER() function. Check the formula.

Column =
CALCULATE (
    SUM ( 'Table'[Net Sales] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Product Number] ),
        'Table'[Prod Ranked by Price] <= EARLIER ( 'Table'[Prod Ranked by Price] )
    )
)

 Capture.PNG

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @JeanMariePBI ,

 

You could use ALLEXCEPT() funtion and EARLIER() function. Check the formula.

Column =
CALCULATE (
    SUM ( 'Table'[Net Sales] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Product Number] ),
        'Table'[Prod Ranked by Price] <= EARLIER ( 'Table'[Prod Ranked by Price] )
    )
)

 Capture.PNG

 

Best Regards,

Jay

MFelix
Super User
Super User

Hi @JeanMariePBI ,

 

Try the following code:

Cumulative =
CALCULATE (
    SUM ( 'Table'[Net Sales] ),
    ALL ( 'Table' ),
    'Table'[Product Number] = EARLIER ( 'Table'[Product Number] )
        && 'Table'[Prod Ranked by Price]
            <= EARLIER ( 'Table'[Prod Ranked by Price] )
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors