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

How to add conditions to identify the row value in cumulative calculation DAX?

Dear Key Users,

 

How could I add addtional conditions to identify the row results in cumulative calculations

 

As in the Table below mentioned, I need to cumulative the "Qty Delta" sort by the Month level, thats give me the column "**bleep** Qty Delta" in dax,

 

But I want this dax formula to add condition is if the "**bleep** Qty Delta" is positive, then the next cumulative calculation will take this positive as 0 in the next calculation, like how this will performed in column "Correct **bleep** Delta" 

 

Chrystal_0-1730966710827.png

Thanks a lot for your help!

Chrystal

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from lbendlin.

 

Hi @Chrystal ,

 

Create a new column and try the following DAX formula:

Result = 
VAR Currentmonth='Table'[Month]
VAR CurrentQtyDelta='Table'[Qty Delta]
VAR PreviousResult=CALCULATE(SUM('Table'[Qty Delta]),FILTER('Table','Table'[Month]<Currentmonth&&'Table'[Qty Delta]<0))
RETURN
IF(CurrentQtyDelta>0,CurrentQtyDelta,PreviousResult+CurrentQtyDelta)​

 

Result:

vlinhuizhmsft_0-1731404614389.png

 

Best Regards,
Zhu

 

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 lbendlin.

 

Hi @Chrystal ,

 

Create a new column and try the following DAX formula:

Result = 
VAR Currentmonth='Table'[Month]
VAR CurrentQtyDelta='Table'[Qty Delta]
VAR PreviousResult=CALCULATE(SUM('Table'[Qty Delta]),FILTER('Table','Table'[Month]<Currentmonth&&'Table'[Qty Delta]<0))
RETURN
IF(CurrentQtyDelta>0,CurrentQtyDelta,PreviousResult+CurrentQtyDelta)​

 

Result:

vlinhuizhmsft_0-1731404614389.png

 

Best Regards,
Zhu

 

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

lbendlin
Super User
Super User

Conditional accumulation is impossible in DAX.  The only way you can do this is in Power Query via List.Accumulate() .

Hi! thanks for your reply, I will check it out!!

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.