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
Power_BI_new
Frequent Visitor

Incorrect Cumulative result on specific rows with Dax

Hi there,

I need your help, I'm stuck, I can't get the 3rd column, I need to create a calculated column which cumulates the amount on certain lines as in the table below :

How do I get my column : "Amount_col" : 
Amount_colIf ('Table'[Category] in {"1.0-Category","2.0-Category","3.0-Category","4.0-Category"},'Table'[Amount],0)
Fichier_Excel.pngHere are the formulas I tried : 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Test 1 = SUMX(FILTER('Table',EARLIER('Table'[Category])='Table'[Category]&&EARLIER('Table'[index]) >= 'Table'[index]),'Table'[Amount_col])

index = IF('Table'[Category]="1.0-Category",1,IF('Table'[Category]="2.0-Category",2,IF('Table'[Category]="3.0-Category",3,IF('Table'[Category]="4.0-Category",4,0))))

Result = This gives me double of each value in the column "Amount_col"

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Test 2 =CALCULATE(SUM('Table'[Amount_col]),FILTER(ALL('Table'),'Table'[Amount_col] <= EARLIER('Table'[Amount_col])))

Result = The results I get are totally wrong, for example instead of getting 300,000 for one line, I'm going to get 400,000,000,000,000

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Thank you in advance for your help

4 REPLIES 4
Anonymous
Not applicable

Hi @Power_BI_new ,

Please try:

Desired Result = 
IF( 
    'Table'[Category] 
        IN {
                "1.0-Category",
                "2.0-Category",
                "3.0-Category",
                "4.0-Category"
            },
    CALCULATE(
        SUM('Table'[Amount_col]),
            FILTER(
                ALL('Table'),
                'Table'[Category] <= EARLIER('Table'[Category])
            )
    ),
    0
)

vcgaomsft_0-1668048387603.png

Best Regards,
Gao

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. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Thank you very much for your answer, just that gives me double, I have to click on the calculated column in the fields and put "Average" to get the right amounts.

How can I modify its directly in the formula?

It's not really double, but almost. I have to click average or not sum to get the right amount. The problem is that I have to recover this amount in another column to make an addition, and suddenly I take the figure which is neither summarized nor with an average

Greg_Deckler
Community Champion
Community Champion

@Power_BI_new You really need an Index column or something that defines what comes before.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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