Forum Discussion

PowerUser123's avatar
PowerUser123
Helper II
4 years ago

Daily Moving Average - Hour on x-axis?

So I have a working daily moving average calculation below:

 

Moving Avg Daily Revenue = 
		AVERAGEX(
			DATESINPERIOD(
				'Dates'[date],
				LASTDATE('Dates'[date]) ,
				 -28 , 
				 DAY),
			CALCULATE(SUM('Transactions'[Revenue] )
			))

 

Currently, the transaction table is connected to the Date table via a transaction date column. I extracted the date and time from this column in the transaction table. I created another column that rounds the time to the nearest hour. That column is what is currently being displayed on my x-axis. I would like to see in a moving average calculation, the moving average of sales over x days that happened in the 8 AM hour, the 9 AM hour, 10 AM hour, etc...

 

I haven't dealt with time too much in Power BI. How would I handle this?

2 Replies