cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Helper III

## Find average of all values in a column (example tables and outputs included)

I'm a little rusty with Power BI so please forgive me.

I have a table with a sales column that looks like this. Let's call it 'Table1'
Location          Sales
A                      500
B                      1000
C                      750
D                      250
E                       1500

I have added a datacard that just calculates the average using the dropdown in the fields pane. Simple enough, right?

When I make a table visual, what I want is a calculate column or measure that shows the average for all locations. So, since the average across all (and the value in my datacard) is 800, I want the output to be this

Location          Sales            Organization Average
A                      500                       800
B                      1000                      800
C                      750                        800
D                      250                       800
E                       1500                       800

That way, I can create a rankx column and rank the locations. I understand that I can just sort the column, but I will be applying this logic to about 5 different areas and want to create a scoring system. I know I have to use ALLSELECTED or ALL but for some reason this is giving me a hard time. Any help would be appreciated, thanks!

1 ACCEPTED SOLUTION
Community Support

Hi , @water-guy-5

According to your description, you want to get the average of the Location.

Here are the steps you can refer to :
[1]If you want to add a calculated column , you can click "New Column" and enter this:

``Average Column = AVERAGEX('Table',CALCULATE(SUM('Table'[Sales]) ,ALLEXCEPT('Table','Table'[Location])))``

The result is as follows:

[2]If you want to create a measure you can click "New measure" and enter this:

``Average = AVERAGEX( ALLSELECTED('Table'[Location]) , CALCULATE(SUM('Table'[Sales])))``

The result is as follows:

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!

Best Regards,

Aniya Zhang

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

2 REPLIES 2
Super User

Hi,

To be able to rank the locations, you do not need to create a column with those averages.  Try these measures:

Total = sum(Data[Sales])

Rank = rankx(allselected(Data[Locations]),[Total])

Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
Community Support

Hi , @water-guy-5

According to your description, you want to get the average of the Location.

Here are the steps you can refer to :
[1]If you want to add a calculated column , you can click "New Column" and enter this:

``Average Column = AVERAGEX('Table',CALCULATE(SUM('Table'[Sales]) ,ALLEXCEPT('Table','Table'[Location])))``

The result is as follows:

[2]If you want to create a measure you can click "New measure" and enter this:

``Average = AVERAGEX( ALLSELECTED('Table'[Location]) , CALCULATE(SUM('Table'[Sales])))``

The result is as follows:

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!

Best Regards,

Aniya Zhang

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

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors