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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Average of measure based on two columns

I need to calculate the average for Rate 1 and Rate 2. Rates 1 and 2 are calculated measured based on other columns not shown. What I currently have for my average measure is: 

 

AverageRate1 = AVERAGEX(VALUES('Table '[NAME]), [Rate 1])
AverageRate2 = AVERAGEX(VALUES('Table '[NAME]), [Rate 2])
 
However, it assumes "unassigned" is one person when I need it to be two separate people because each is in a different location. How do I calculate the average of Rate 1 based on each person and location? My data is confidential, so I cannot share my pbix file. I have attached sample data. Thank you! 
 
2020-02-10_15-13-37.jpg
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I figured out a way to do this. I am not sure if this is the most efficient, but it works. 

 

Edit Queries: 

Create calculated column 

Name 2 = If (Sheet 1 [Name]) = "Unassigned', Location, 'Sheet 1' [Name])

 

Then I calculated average with: 

 

Average 63 = Calculate (AverageX(Values('Sheet 1'[Name 2]), [Wthin 63 day]))

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

I figured out a way to do this. I am not sure if this is the most efficient, but it works. 

 

Edit Queries: 

Create calculated column 

Name 2 = If (Sheet 1 [Name]) = "Unassigned', Location, 'Sheet 1' [Name])

 

Then I calculated average with: 

 

Average 63 = Calculate (AverageX(Values('Sheet 1'[Name 2]), [Wthin 63 day]))

 

v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

You need 2 measures as below:

 

 

Measure = CALCULATE(AVERAGE('Table'[Rate 1]),ALLEXCEPT('Table','Table'[Location]))
Measure 2 = CALCULATE(AVERAGE('Table'[Rate 2]),ALLEXCEPT('Table','Table'[Location]))

 

Then you will see:

Annotation 2020-02-11 120941.png

Best Regards,
Kelly

 

 

 

Anonymous
Not applicable

@v-kelly-msft  Thank you!

 

This makes sense, but Rate 1 is not a column in my table. It is a calculated measure, so I got an error when I tried your suggestion.

 

Currently, I have: 

AverageRate1 = AVERAGEX(VALUES('Table 1'[Name]), [Rate 1])

 

But then it combines Mark for both locations, when I want the measure to calculate mark as two separate people.

 

I tried: 

AverageRate1 = CALCULATE (AVERAGEX(VALUES('Table 1'[Name]), [Rate 1])), ALLEXCEPT ('Table 1', 'Table 1' [LOCATION]))

 

but that is not giving me the accurate percentage. 

 

Thank you! 

 

 

TomMartens
Super User
Super User

Hey @Anonymous ,

 

I guess this will work:

AVGRate1 =
AVERAGEX(
	ADDCOLUMNS(
		SUMMARIZE(
			'<tablename>'
			,'<tablename>'[Location]
			,'<tablename>'[Name]
		)
		"r1" , [Rate 1]
	)
	, [r1]
)

You can create the measure for [Rate 2] accordingly.

 

If this does not work, please create a pbix file that contains sample data, but still reflects your data model, upload the pbix to onedrive or dropbox and share the link.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hi, @TomMartens 

 

Thank you for your reponse! Attached is a sample pbix file. 

 

I created two measures to calculate the rate within 63 days and the rate within 126 days for each name. 

 

I need to calculate the average rate within 63 days and within 126 days. When I use the following dax, it assumes Unassigned as one person when I need it to calculate it as two. In other words, I need to calculate the average rate within 63 days by row under Name column. Thanks!! 

 

Sample Data 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors