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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Finding the sum of a column based on previous date

Hello, 

 

I am looking to return an aggregate of values based on the month it is in. I have a 'DateAssigned' Column that is not continuous and a Calendar'Date' column that is continuous. 

 

DateAssigned TrailersAssignedTotalRoutesCompletedCalibrationsReceivingTempsVerified

10/2/2022192011
10/3/2022111811
10/4/2022212111
10/5/2022152011
10/6/2022212111
10/7/20220311
10/9/2022171711
10/10/2022181811
10/11/2022212111
10/12/2022192011
10/13/2022172211
10/14/20223311
10/16/2022171711
10/17/2022181811
10/18/2022212111
10/19/2022172111
10/20/2022212111
10/21/20220311
10/23/202201711
10/24/2022171811
10/25/2022202111
10/26/202212011
10/27/2022172111
10/28/20223311
10/30/2022171711
10/31/2022181811
11/1/202221211 
11/2/202220201 
11/3/202214211 
11/4/2022331 
11/6/20220171 
11/7/202218181 
11/8/202216211 
11/9/202217201 
11/10/202221211 
11/11/2022331 
11/13/20221717  
11/14/20221818  
11/15/20222121  
11/16/20221920  
11/17/2022 29  

 

I would like to return the sum of 'Completed Calibrations' only in the previous month (October). I would like for this to be dynamic so when it's December I can see the data for November.

 

Thank you,

 

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

Hi , @Anonymous 

According to your description, you want to calcualte the sum of [Completed Calibrations] in the last month.

Here are the steps you can refer to:

(1)My test data is the same as yours.

(2)We can create a measure :

 

Last Month value = var _currrent_date = MAX('Table'[DateAssigned])
var _t =FILTER(ALLSELECTED('Table') , MONTH('Table'[DateAssigned]) = MONTH(_currrent_date)-1)
return
SUMX(_t , [CompletedCalibrations])

(3)Then we can put the date and this measure in the viusal and we will meet your need:

vyueyunzhmsft_0-1669082268360.png

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description, you want to calcualte the sum of [Completed Calibrations] in the last month.

Here are the steps you can refer to:

(1)My test data is the same as yours.

(2)We can create a measure :

 

Last Month value = var _currrent_date = MAX('Table'[DateAssigned])
var _t =FILTER(ALLSELECTED('Table') , MONTH('Table'[DateAssigned]) = MONTH(_currrent_date)-1)
return
SUMX(_t , [CompletedCalibrations])

(3)Then we can put the date and this measure in the viusal and we will meet your need:

vyueyunzhmsft_0-1669082268360.png

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.