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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
michaelsh
Kudo Kingpin
Kudo Kingpin

Most efficient way to calculate AverageX for several columns from different tables

Hello friends,

My data looks as follows - it is Sales table, each row - is one sale transaction.

I need to calculate average sales amount per Salesperson per Month (without showing any column on axis, just measure)

I know how to do it if it were to calculate avg per one column, say Month:

AVERAGEX(VALUES(Calendar[Month]),SUM(Sales[Amt]))

How do I calculate the average per two (or more) columns that are also coming from different tables (Calendar, Sales...)?

I am looking for the most efficient way (from query speed performance perspective)

Thank you

michaelsh_0-1616603037490.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@michaelsh , Try a measure like

AVERAGEX(Summarize(Sales, Sales[Salesperson],Calendar[Month],"_1",SUM(Sales[Amt])),[_1])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
michaelsh
Kudo Kingpin
Kudo Kingpin

@amitchandak  
Actually, here I see that SUMMARIZE is not the most efficient way to do agregation calculations...

@michaelsh , I tried to summarize columns in past. somehow it did not work in this scenario. 

If this is one group by, I prefer values. 

I will continue to play around on this. Will update, 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
v-eqin-msft
Community Support
Community Support

Hi @michaelsh ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept @amitchandak 's reply as the solution. More people will benefit from it.

 

Or please provide me with more details about your two tables (Calendar and Sales) and the relationships or share me with your pbix file from your Onedrive for Business after removing sensitive data.

 

Best Regards,
Eyelyn Qin

 

amitchandak
Super User
Super User

@michaelsh , Try a measure like

AVERAGEX(Summarize(Sales, Sales[Salesperson],Calendar[Month],"_1",SUM(Sales[Amt])),[_1])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Excellent, @amitchandak it works!

Interesting, although we summarize Sales table, we can use Month column from another, Calendar table.

Thanks!

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors