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
Frasermc98
Frequent Visitor

Calculating the average of max values hit across a week

I obtain a daily measure of a top speed that a person hits in training during a session. I also have a date table set up that contains the weeks of the season. I am wondering if it is possible to calculate in DAX the max speed hit across the week and then average this max speed hit across the weeks. 

 

Any help in doing this would be greatly appreciated. 

 

Thanks. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Frasermc98 

 

Please try this:

First of all, I create a set of sample data:

vzhengdxumsft_0-1706521470777.png

The week number is created by 

week number = WEEKNUM('Sheet1'[date])

Then I crreate a measure and create a matrix with it:

max of speed = MAX('Sheet1'[speed])

vzhengdxumsft_1-1706521627397.png

After that, I create a measure to count the average value of the max speed:

average of speed = 
	VAR _MAX = ADDCOLUMNS(
		ALLSELECTED('Sheet1'),
		"_MAXSPEED", CALCULATE(
			MAX('Sheet1'[speed]),
			FILTER(
				ALLSELECTED('Sheet1'),
				'Sheet1'[week number] = EARLIER('Sheet1'[week number])
			)
		)
	)
	RETURN
		AVERAGEX(
			_MAX,
			[_MAXSPEED]
		)

The result is as follow:

vzhengdxumsft_3-1706521866307.png

 

Best Regards,

Zhengdong Xu

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Frasermc98 

 

Please try this:

First of all, I create a set of sample data:

vzhengdxumsft_0-1706521470777.png

The week number is created by 

week number = WEEKNUM('Sheet1'[date])

Then I crreate a measure and create a matrix with it:

max of speed = MAX('Sheet1'[speed])

vzhengdxumsft_1-1706521627397.png

After that, I create a measure to count the average value of the max speed:

average of speed = 
	VAR _MAX = ADDCOLUMNS(
		ALLSELECTED('Sheet1'),
		"_MAXSPEED", CALCULATE(
			MAX('Sheet1'[speed]),
			FILTER(
				ALLSELECTED('Sheet1'),
				'Sheet1'[week number] = EARLIER('Sheet1'[week number])
			)
		)
	)
	RETURN
		AVERAGEX(
			_MAX,
			[_MAXSPEED]
		)

The result is as follow:

vzhengdxumsft_3-1706521866307.png

 

Best Regards,

Zhengdong Xu

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

 

audreygerred
Super User
Super User

Hello! You will want to use an interator function here: AVERAGEX

http://powerbiwithme.com/2023/11/01/the-iterator-edition/

AVERAGEX function (DAX) - DAX | Microsoft Learn

Try:

AverageOfMaxValues = AVERAGEX( VALUES('YourTable'[GroupColumn]), CALCULATE( MAX('YourTable'[ValueColumn]) ) )





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.