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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Calculate cumulative with missing data

Hi all,

I wanted to calculate the cummulative amount, but in week 4 there is no information so the DAX return blank.

I want to return the value of the closest week which has value. Please support.

Thank you,

 

Here is my DAX:

Measure =
CALCULATE(SUM(Sheet1[Value]),FILTER(ALL(Sheet1[Week]),Sheet1[Week]<=MAX(Sheet1[Week])))
 
Input data

ThanhPham_1-1631015366761.png

 

Result:

ThanhPham_0-1631015223126.png

 
1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi ThanhPham,

 

1 Create a new table with this

Table = VALUES('Sheet1'[week])

 

2 Change the last part of your measure where I have marked it.

Measure = CALCULATE(SUM(Sheet1[Value]),FILTER(ALL(Sheet1[Week]),Sheet1[Week]<=MAX(Table[week])))

 

3 By your pictures, I see that you use Matrix visual. Replace the week field from sheet1 table with the new week in the new table just created(As shown below).

vchenwuzmsft_0-1631236197123.png

 

 

Result :

vchenwuzmsft_1-1631236197127.png

 

 

Best Regards

Community Support Team _ chenwu zhu

 

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

View solution in original post

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

Hi ThanhPham,

 

1 Create a new table with this

Table = VALUES('Sheet1'[week])

 

2 Change the last part of your measure where I have marked it.

Measure = CALCULATE(SUM(Sheet1[Value]),FILTER(ALL(Sheet1[Week]),Sheet1[Week]<=MAX(Table[week])))

 

3 By your pictures, I see that you use Matrix visual. Replace the week field from sheet1 table with the new week in the new table just created(As shown below).

vchenwuzmsft_0-1631236197123.png

 

 

Result :

vchenwuzmsft_1-1631236197127.png

 

 

Best Regards

Community Support Team _ chenwu zhu

 

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

amitchandak
Super User
Super User

@Anonymous , Create a new table with a distinct week  or use generateseries

 

Week = distinct([Week])  // or use//  generateseries(1,53,1) 

 

Join this week of your table and create a measure like

 

calculate(sum(Table[Value]) , Filter(allselected(Week), [Week] <= max(Week[Week])))

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors