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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sreddy47652
Helper III
Helper III

running total and cumulative count by descending order

Hi Team, i have supplier id, Total sales and want show cumulative count and running total by desending order.  I have basic measures

Total sales= Sum(Sales[salesamount]) and running total , cumulative count measures.

I want to show total sales amount by desending order vice versa to show running total cumulative count in desending order so itried with different ways to achoeve visul level filter(but can't apply other measures) and ranking functionality but none of them is not working so can anyone help me to get Running Total and cumulative count measures with Desending order for Total sales with Running total and Cumulative count.

sreddy47652_0-1730640420085.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sreddy47652 ,

 

Thanks to FreemanZ  and DataNinja777  for their quick replies. I have some other thoughts to add:

(1) We can create measures.

rank =
RANKX (
    SUMMARIZE ( ALL ( 'Sales' ), [supplier_id], "total", [Total sales] ),
    [total],
    [Total sales],
    ASC
)
Cumulative sales by rank =
VAR _table =
    SUMMARIZE (
        ALL ( 'Sales' ),
        [supplier_id],
        "total", [Total sales],
        "rank", [rank]
    )
VAR _rank = [rank]
RETURN
    CALCULATE ( [Total sales], FILTER ( _table, [rank] <= _rank ) )

(2) Then the result is as follows.

vtangjiemsft_0-1730879205959.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @sreddy47652 ,

 

Thanks to FreemanZ  and DataNinja777  for their quick replies. I have some other thoughts to add:

(1) We can create measures.

rank =
RANKX (
    SUMMARIZE ( ALL ( 'Sales' ), [supplier_id], "total", [Total sales] ),
    [total],
    [Total sales],
    ASC
)
Cumulative sales by rank =
VAR _table =
    SUMMARIZE (
        ALL ( 'Sales' ),
        [supplier_id],
        "total", [Total sales],
        "rank", [rank]
    )
VAR _rank = [rank]
RETURN
    CALCULATE ( [Total sales], FILTER ( _table, [rank] <= _rank ) )

(2) Then the result is as follows.

vtangjiemsft_0-1730879205959.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

FreemanZ
Super User
Super User

hi @sreddy47652 ,

 

try like:

running total =

VAR _sales = [Total sales]

VAR _result =

CALCULATE(

    [Total sales],

    FILTER(

        ALL(sales[supplier id]),

        [Total sales] <= _sales

    )

)

RETURN _result

 

 

cumulative count =

VAR _sales = [Total sales]

VAR _result =

CALCULATE(

    COUNT(sales[supplier id]),

    FILTER(

        ALL(sales[supplier id]),

        [Total sales] <= _sales

    )

)

RETURN _result

Thanks for providing the above formulas but still it's giving  visual exceding memory issues even i have 15k records in my table. I need Totalsales values with cumulative and running total in descending order.

DataNinja777
Super User
Super User

Hi @sreddy47652 ,

 

I suppose your company's sales are made to customers and not suppliers 😉.  You can produce your required output by writing a measure like below:

Rank = 
CALCULATE (
    RANKX (
        ALL ( 'Sales'[salesamount] ),
        CALCULATE (
            SUM ( 'Sales'[salesamount] ),
            ALL ( 'Sales'[supplier_id] )
        )
    )
)

 

DataNinja777_0-1730644186872.png

Using the Rank calculated column as shown above, cumulative sales measure is written as follows:

Cumulative sales by rank = 
CALCULATE (
    [Total sales],
    FILTER ( ALL ( 'Sales' ), 'Sales'[Rank] <= MAX ( 'Sales'[Rank] ) )
)

 

The resultant output will look like below:

DataNinja777_1-1730644282450.png

I have attached an example pbix file for your reference:

 

Best regards,

Thanks for providing the above formulas but still it's giving  visual exceding memory issues even i have 15k records in my table. I need Totalsales values with cumulative and running total in descending order.

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.