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
vivek280393
New Member

Need help in fixing the DAX formula

Hi,

 

I am trying to display previous count total based on the date column. I have a column called marks along with dates. I am trying to sum the marks column based on the previous dates but it is giving me rolling sum of all the previous dates to the current date. 

 

Screenshot:

Here instead of 1437 i should get 800 which is previous date total

 

vivek280393_0-1730992449014.png

 

 

I am attaching the sample pbix file with the data and calculation so somebody can help me to fix the issue?

@lbendlin @rajendraongole1 @Ritaf1983 @SamWiseOwl @FreemanZ @vojtechsima @sandeepsai @johnt75  

 

Regards

Vivek N

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

Hello, @vivek280393 
The attachment didn't go  trought, so I made myself some data:

 

 

prev_marks = 
var currentDate = 'Table'[date]
var _previousDay = MAXX(FILTER(ALL('Table'), 'Table'[date]< currentDate), 'Table'[date])
var _previousDay_value = MAXX(FILTER(ALL('Table'), 'Table'[date]= _previousDay), 'Table'[total_marks])

return _previousDay_value

 

 

 

vojtechsima_0-1730996239131.png

 

 






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

View solution in original post

2 REPLIES 2
vojtechsima
Super User
Super User

Hello, @vivek280393 
The attachment didn't go  trought, so I made myself some data:

 

 

prev_marks = 
var currentDate = 'Table'[date]
var _previousDay = MAXX(FILTER(ALL('Table'), 'Table'[date]< currentDate), 'Table'[date])
var _previousDay_value = MAXX(FILTER(ALL('Table'), 'Table'[date]= _previousDay), 'Table'[total_marks])

return _previousDay_value

 

 

 

vojtechsima_0-1730996239131.png

 

 






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

Hi @vojtechsima 


Thanks your solution worked. Now i am facing another issue for a similar case. Please check the below screenshot, I am trying to calculate the previous average percentage column based on reporting date and system name columns. Previously it was only with reporting date and now i have to consider system name also while calculating the previous average percentage. I tried your approach and modified to make it work but getting error? can you please check and let me know where i am going wrong here?

vivek280393_0-1731085543879.png

 

Regards

Vivek N

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.