DAX Average with Text Values

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
I'm trying to calculate an Average in a PowerPivot table on a column that contains numbers and blanks - but the blanks are not true blanks, but rather "" values. I need to Average where there is not a "". For instance,

Values:
1
2
3
""
4

Should calculate as (1 + 2 + 3 + 4) / 4 values that are not "".

This is the default behavior of the standard AVERAGE or use in Pivot Tables, but not so in Power Pivot. How can I write a formula that will ignore those blanks?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
My first suggestion would be to convert the Values column to a numeric data type (with Power Query for example), so that blanks are genuine blanks. Then AVERAGE will give you the average ignoring blanks.

If the Values column has to be text, you could use IFERROR(VALUE(...)) to ignore non-numeric text:
Average Ignoring Text := AVERAGEX( Table, IFERROR( VALUE(Table[Value]), BLANK() ) )
 
Upvote 0
My first suggestion would be to convert the Values column to a numeric data type (with Power Query for example), so that blanks are genuine blanks. Then AVERAGE will give you the average ignoring blanks.

Would you mind expanding on this a little? I'm new to Power Query - would I query the existing table in Power Query, and then use Power Pivot off of that? Would doing this create a whole second set of data or would it be kept in the background?
 
Upvote 0
Hi again,
You should create a Power Query query that refers to your original source (Excel table or otherwise), manipulate as required, then load this Power Query table to Power Pivot. The Power Query table doesn't need to appear in the spreadsheet, but would be a connection.
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,785
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top