Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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!!
Solved! Go to Solution.
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
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:
thank you for another solution. It's greate !
please mark topic as resolved 🙂
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |