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
jct999
Advocate II
Advocate II

Cumulative sum

Hello,

 

I have a dataset with 3 columns : PRODUCT, DAY and QUANTITY.

I want to set up a pivot table that displays :

  • Quantity per product and per day
  • Cumulative quantity per product, day over day.

Capture.PNG

 

I created a measure to calculate the Cumulative quantity :

CUMULATIVE :=

VAR CURRENT_DAY = MAX( 'DATASET'[DAY])
RETURN CALCULATE(

SUM('DATASET'[QUANTITY]);

ALL('DATASET'[DAY]);'DATASET'[DAY]<=CURRENT_DAY)

 

Problem : I have no data for Product 2 on Day 15 ; then my measure can't calculate the cumulative quantity for this product on this day.
Quite easily, I think that the reason is that the CURRENT_DAY variable is blank for Product 2 on Day 15 😫

 

Does anyone can help me to modify the measure in order to enable the calculation of the Cumulative quantity in this context (i.e even if there is no data) ?

 

Note that : I need a solution that works in PowerBI and Excel 2016. I have no calendar table in my model, Days are just numbers from 1 to 20.

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@jct999 

On day 15 for Product 2, there is no record, so the formula cannot produce a result. To achieve what you need, you need to create a dimension table for DAY. Please check the attached file where you will find the solution. You need to modify your formula to point to the dimension table for DAY.

Fowmy_0-1620424915219.png

 

 

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@jct999 

On day 15 for Product 2, there is no record, so the formula cannot produce a result. To achieve what you need, you need to create a dimension table for DAY. Please check the attached file where you will find the solution. You need to modify your formula to point to the dimension table for DAY.

Fowmy_0-1620424915219.png

 

 

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.