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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Syndicate_Admin
Administrator
Administrator

Average between columns

Hello all

I need a help that maybe is simple but I have already watched several videos and forus and it does not work for me. I need to create a column that calculates the average of the 5 colunmas (Y1, Y2; Y3; Y4 and Y5) but only if they are non-zero.

How do I do that? or is it better to create measures than to create columns? The data comes as shown in the example and this new data I have I will use quite even then create new measures.

I really appreciate your help!!

DianisB_0-1657621134422.png

1 ACCEPTED SOLUTION
SolomonovAnton
Super User
Super User

hello 

 

I think it will help you:

 

calculation column = 

var _Y1 = if([Y1]=0,blank(),[Y1])

var _Y2 = if([Y2]=0,blank(),[Y2])
var _Y3 = if([Y3]=0,blank(),[Y3])
var _Y4 = if([Y4]=0,blank(),[Y4])

var _Y5 = if([Y5]=0,blank(),[Y5])

var _result = (_Y1+_Y2+_Y3+_Y4+_Y5)/(_Y1/_Y1+_Y2/_Y2+_Y3/_Y3+_Y4/_Y4+_Y5/_Y5)
return _result

 

View solution in original post

3 REPLIES 3
SolomonovAnton
Super User
Super User

hello 

 

I think it will help you:

 

calculation column = 

var _Y1 = if([Y1]=0,blank(),[Y1])

var _Y2 = if([Y2]=0,blank(),[Y2])
var _Y3 = if([Y3]=0,blank(),[Y3])
var _Y4 = if([Y4]=0,blank(),[Y4])

var _Y5 = if([Y5]=0,blank(),[Y5])

var _result = (_Y1+_Y2+_Y3+_Y4+_Y5)/(_Y1/_Y1+_Y2/_Y2+_Y3/_Y3+_Y4/_Y4+_Y5/_Y5)
return _result

 

Thank you very much for your help and I am glad that we can find the solutions by these means 🙂 ... then I also found a very similar one that worked:

Average =
where _Numerador = [Y1] + [Y2] + [Y3] + [Y4] + [Y5]
where _Denominador =
WHERE _1 = if (ISBLANK([Y1])||[Y1]=0, 0, 1)
WHERE _2 = if (ISBLANK([Y2])||[Y2]=0, 0, 1)
WHERE _3 = if (ISBLANK([Y3])||[Y3]=0, 0, 1)
where _4 = If (ISBLANK([Y4])||[Y4]=0, 0, 1)
where _5 = IF (ISBLANK([Y5])||[Y5]=0, 0, 1)
return
_1+_2+_3+_4+_5
return
IFERROR(_Numerador/_Denominador,0)

thank you for another solution. It's greate ! 

 

please mark topic as resolved 🙂

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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