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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
rodrigorsrv
New Member

Building a cumulative subtotal

Hi People!

I'm trying to build an income statement report and I'm at a loss with building something so apparently so simple as the cumulative subtotals.

My data table looks like this

Account | Category | Amount | Year

And I'd like to get to this:

 

CategoryAmount
Revenues100
Costs(40)
Gross profit60
Administrative expenses(11)
Other operating results4
Operating profit53
Financial results(12)
Net income before tax41
Income tax(10)
Net profit31

 

So basically up until Gross profit I'm ok but how could I make it that operating profit not only adds Administrative expenses and other operating results but also the previous subtotal of Gross profit (same with the following subtotals)?

 

I though about making it through some power query grouping, table referencing and appending but I don't think it would be a proper way of doing it so.

Any help will be appreciated!

 

 

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @rodrigorsrv,

 

Can you please try?

 

1. Create a Total Amount Measure

Total Amount = SUM('Table'[Amount])

2. Create a Cumulative Subtotal Measure

Cumulative Subtotal = 
CALCULATE(
    [Total Amount],
    FILTER(
        ALL('Table'),
        'Table'[CategoryOrder] <= MAX('Table'[CategoryOrder])
    )
)

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Thanks!

I tried as you said but I arrived to this:

 

Maybe I didn't fully understand but I didn't get exactly what I wanted. These running subtotales should be in the same column.

 

Alternatively I tried this but I think it's overly complex and not scalable:

1. Modified the data structure

 

 

rodrigorsrv_6-1710681953608.png

 

 

2.  Next, I created only one conditional measure:

Total Amount = if(AVERAGE('Table'[Level])<2,sum('Table'[Amount]),CALCULATE(
    sum('Table'[Amount]),
    FILTER(
        ALL('Table'),
        'Table'[CategoryOrder] <= MAX('Table'[CategoryOrder])
    )
))

 

 

3. I've ended up with this, as you may see it wasn't really a practical solution.

 

rodrigorsrv_4-1710681698056.png

 

 

 

 

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors