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

 

 

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

 

 

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors