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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
gumis_rulez
Helper I
Helper I

Properly calculating cummulative value

I am struggling with cummulative value when I am creating a summarize table in dax measure:

 

ciisuse.JPG

I am using "others" to calculate the result for all other customers which have rank higher than parameter.

The revenue measure is following:

 

Revenue = 

Var OrderOfAll = CALCULATE([Total Sales Dates Range Param.], REMOVEFILTERS(hlpCustomer[customer_name]))

RETURN
    IF(
        ISINSCOPE(hlpCustomer[customer_name]),
         Var ProductsToRank = hlpNumber[Number Value]
         Var IsotherSelected = SELECTEDVALUE(hlpCustomer[customer_name]) = "Others"
         Var ProductsWithOrderAmt = 
         ADDCOLUMNS(ALLSELECTED(hlpCustomer[customer_name]), "@Amt", [Total Sales Dates Range Param.])
         Var Top3Prods = TOPN(ProductsToRank, ProductsWithOrderAmt, [@Amt])
         Var OrdersOfTop3 = SUMX(Top3Prods, [@Amt])
         Var Result = IF(IsotherSelected, OrderOfAll - OrdersOfTop3, [Total Sales Dates Range Param.])
         Return Result, OrderOfAll
         
         
         
        )

 

How to properly calculate increasing sum (cummalitive) - red colour on the screenshot?

 

https://drive.google.com/file/d/1Y936d8gqn4JYdWi8PXyR9tHXqUo6pyJ0/view?usp=sharing 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from FlipFlop1 and Selva-Salimi.

 

Hi @gumis_rulez  , 

 

Here is the formula I provided:

 

MEASURE =
VAR _table =
ADDCOLUMNS (
SUMMARIZE ( ALL ( 'hlpCustomer' ), 'hlpCustomer'[customer_name] ),
"rank", [Rank]
)
VAR _current_rank = [Rank]
RETURN
IF (
ISINSCOPE ( hlpCustomer[customer_name] ),
SUMX ( FILTER ( _table, [rank] <= _current_rank ), [Revenue] )
)

 

The result is as follows:

vlinhuizhmsft_0-1725961314990.png

Best Regards,
Zhu
Community Support Team

 

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks for the reply from FlipFlop1 and Selva-Salimi.

 

Hi @gumis_rulez  , 

 

Here is the formula I provided:

 

MEASURE =
VAR _table =
ADDCOLUMNS (
SUMMARIZE ( ALL ( 'hlpCustomer' ), 'hlpCustomer'[customer_name] ),
"rank", [Rank]
)
VAR _current_rank = [Rank]
RETURN
IF (
ISINSCOPE ( hlpCustomer[customer_name] ),
SUMX ( FILTER ( _table, [rank] <= _current_rank ), [Revenue] )
)

 

The result is as follows:

vlinhuizhmsft_0-1725961314990.png

Best Regards,
Zhu
Community Support Team

 

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

FlipFlop1
Advocate I
Advocate I

So you can use a quick measure to generate the cumulative total for you: See Quick Measure > Running total.

I think the DAX will look like this for your example:


Sales running total in Customer_name =
CALCULATE(
    [Revenue],
    FILTER(
        ALLSELECTED(),
        ISONORAFTER('hlpCustomer'[customer_name], MAX('hlpCustomer'[customer_name]),ASC)
    )
)

 
 
Selva-Salimi
Super User
Super User

@gumis_rulez 

 

you can write it as follows:

 

calculate (sum(revenue), filter (table, evenue <= earlier (revenue))

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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