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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Custom column - Average excluding "NA" values

Dear all,

 

I kindly need your expertise for creating a custom column that calcuates the average of several columns. The problem is I have a dataset that includes some "NA" values:

 

WhiteBlackYellowRedCustom column (average of all colors)
3668Error
19NA7Error

 

If I included the "Yellow" column when calculating the average, the custom column gives an error because of the "NA" value.

 

What I am trying is to exclude the cells with "NA" values.

 

Excel is automatically excluding the "NA" values while calculating the average, but it seems that PowerBI does not.

 

Do you guys think of a workaround for this?

 

Thanks for your support in advance.

 

Ugur

3 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

Use something along the lines of:

 

Measure = AVERAGEX(FILTER('Table',[Yellow]<>"NA"),[Yellow])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

sgsukumaran
Resolver II
Resolver II

Option 1: As pointed out use filter in your query

Option 2: Default value to 0 when blank or NA occurs that way your regular calculation would work.

View solution in original post

v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to Greg_Deckler's solution, also, you could refer to replace the 'NA' value in query editor:

 1.PNG

 

Hope it could help you.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

4 REPLIES 4
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to Greg_Deckler's solution, also, you could refer to replace the 'NA' value in query editor:

 1.PNG

 

Hope it could help you.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sgsukumaran
Resolver II
Resolver II

Option 1: As pointed out use filter in your query

Option 2: Default value to 0 when blank or NA occurs that way your regular calculation would work.

Greg_Deckler
Community Champion
Community Champion

Use something along the lines of:

 

Measure = AVERAGEX(FILTER('Table',[Yellow]<>"NA"),[Yellow])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.