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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Need Help in trailing average

I have a column of List_Date  (mm/dd/yyy) for dates beginning in 2012-2017. I also have a Sales_Pric column, for which I would like to calculate the 3-month trailing average and 12-month trailing average of the NUMBER of sales/mo. 

 

We need to use sales as count of sales. 

 

Please let me know first I need to add one column of count of the sales? or Sales_Pric column can be user directly to find the trailing average.

Screenshot_1.png

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Here is a 12 month trailing average that i've been using.  This requires a Date Table which includes a column called "YEARMONTH" which is simply a concatination of year and month.  I.e. January 2017 = "201701"

 

Measure 12 Mth Avg = CALCULATE( 
	if(
		countrows(values('Dim - Date Table'[YearMonth])) = 1, 
		[Your Measure], 
		AVERAGEX(
			values('Dim - Date Table'[YearMonth]), 
			[YourMeasure]
		)
	),
	DATESINPERIOD(
		'Dim - Date Table'[Date], 
		LASTDATE('Dim - Date Table'[Date]), 
		-12, 
		MONTH
	)
)


Would this work for you?

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Here is a 12 month trailing average that i've been using.  This requires a Date Table which includes a column called "YEARMONTH" which is simply a concatination of year and month.  I.e. January 2017 = "201701"

 

Measure 12 Mth Avg = CALCULATE( 
	if(
		countrows(values('Dim - Date Table'[YearMonth])) = 1, 
		[Your Measure], 
		AVERAGEX(
			values('Dim - Date Table'[YearMonth]), 
			[YourMeasure]
		)
	),
	DATESINPERIOD(
		'Dim - Date Table'[Date], 
		LASTDATE('Dim - Date Table'[Date]), 
		-12, 
		MONTH
	)
)


Would this work for you?

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.