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
Natalia2024
Regular Visitor

Cumulative sum measure

Hello,

 I have the following cumulative sum measure which is built like that:

ArticleRank = RANKX(ALL(vdimarticle_v2),[Calculation KPI],,DESC,Dense)
PercentageofTotal = 
var TotalKPI = CALCULATE([Calculation KPI],ALL(dimarticle))
RETURN
 DIVIDE([Calculation KPI],TotalKPI)
CumulativeSumTop102 = 
var Top10Table = CALCULATETABLE(
                                  dimarticle_v2,
                                  FILTER(
                                    ALL(dimarticle_v2),
                                    [ArticleRank]<=30
                                  )
)
var CurrentArticleSum = [PercentageofTotal]
RETURN
    CALCULATE(
        [PercentageofTotal],
        FILTER(
            Top10Table,
            [PercentageofTotal]>=CurrentArticleSum
        )
    )

It works as follows, it ranks articles based on quantity and then it takes quantity of the first article and divides it by total quatity, for second article, it takes quantity of the first article + quantity of the second article and then  divides it by total quantity etc.

But I have problem if I filter sth on table dimarticle, because than measure shows incorrect numbers, do You know how to avoid this situation so allow users filtering on the table and make this cuulativesum be adjusted accordingly to the filters?

Thank you in advance,

Natalia

2 REPLIES 2
Rupak_bi
Solution Sage
Solution Sage

hi @Natalia2024 

 

try to modify you All(table) to AllSelected(table) so that the table works based on your slicers/filters. if still not work, share your dataset with sample data and desired output scenarions.



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Thank you so much for the response but ALLSELECTED didn't work in this case, I rewrote this measures a bit differently and now it works.

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.