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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
hemantkg
Frequent Visitor

Running Total - Incorrect Results

I have searched the forum for possible solution to below scenario, could not find any leads.

 

Following is the data snapshot:

DateSales PersonGeographySales
1/1/2017AX10
1/1/2017AY10
1/1/2017AZ10
1/1/2017BX10
1/1/2017BY10
1/1/2017BZ10
1/1/2017CX10
1/1/2017CY10
1/1/2017CZ10
1/2/2017AX10
1/2/2017AY10
1/2/2017AZ10
1/2/2017BX10
1/2/2017BY10
1/2/2017BZ10
1/2/2017CX10
1/2/2017CY10
1/2/2017CZ10
1/3/2017AX10
1/3/2017AY10
1/3/2017AZ10
1/3/2017BX10
1/3/2017BY10
1/3/2017BZ10
1/3/2017CX10
1/3/2017CY10
1/3/2017CZ10
1/4/2017AX10
1/4/2017BX10
1/4/2017CX10
1/4/2017AY10
1/4/2017BY10
1/4/2017CY10
1/4/2017AZ10
1/4/2017BZ10

 

Notice how C Sales person for Z geography is missing for 1/4/2017. 

 

This is the calculation for calculating MTD value:

MTD = CALCULATE(SUM(Sheet1[Sales]), ALLEXCEPT(Sheet1, Sheet1[Sales Person], Sheet1[Geography]), Sheet1[Date] <= EARLIER(Sheet1[Date]), DATESMTD('Date'[Date]))

 

This is the output generated:

DateSalesMTD
1/1/20179090
1/2/201790180
1/3/201790270
1/4/201780320

 

As you see the result expected for 1/4/2017, is 270+80=350. But what is happening here is that since C, Z combination is missing for 1/4/2017, the previous sum of this combination is missed and the result is 320.

 

How will I get the expected result? Thanks in advance.

2 ACCEPTED SOLUTIONS

@hemantkg

 

The problem is that you want a calculated column and my answer was to a measure =(

 

I'm sure that other friends in community can help you. I'm sign out until tomorrow.

 

Good Luck

 

 

 




Lima - Peru

View solution in original post

tringuyenminh92
Memorable Member
Memorable Member

Hi @hemantkg,

It's 320 cause you are using calculated column. Behind the scenes, it iterates row by row and cumulatives sum values, but there are 8 rows in April when it should be 9 rows as another months. My recommendation is using calculated measure.

View solution in original post

6 REPLIES 6
tringuyenminh92
Memorable Member
Memorable Member

Hi @hemantkg,

It's 320 cause you are using calculated column. Behind the scenes, it iterates row by row and cumulatives sum values, but there are 8 rows in April when it should be 9 rows as another months. My recommendation is using calculated measure.

Thanks @tringuyenminh92. The following formula gives the correct and expected result for a measure:

 

TOTALMTD(Sum(Sheet1[Sales]), Sheet1[Date])

Vvelarde
Community Champion
Community Champion

@hemantkg

 

Try using TotalMTD

 

MTD = TOTALMTD(SUM(Table1[Sales]),Table1[Date])




Lima - Peru

Thanks Victor for quick reply. Tried it, it doesnt even work as expected:

Capture.PNG

 

 

The TOTALMTD works now, but it is working same as the other calculation, this is the TOTALMTD formula:

 

MTD using Total MTD = TOTALMTD(Sum(Sheet1[Sales]), 'Date'[Date], ALLEXCEPT(Sheet1, Sheet1[Sales Person], Sheet1[Geography]))

 

Capture2.PNG

 

But we still have the missing previous total for combination mentioned in OP.

@hemantkg

 

The problem is that you want a calculated column and my answer was to a measure =(

 

I'm sure that other friends in community can help you. I'm sign out until tomorrow.

 

Good Luck

 

 

 




Lima - Peru

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.