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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Create DAX measure from Excel Formula

Hello-

 

I am looking to re-create the below excel formula using DAX in Power BI.

 

save.png

 

When I do it in Power BI, I get column results:

23

17

18

0

0

0

 

The end column result should be the yellow column (like the screenshot above):

23

17

18

9.666

9.666

9.666

 

I tried DAX Formula --> 

Column = CALCULATE(IF(Table1[2020 Forecast_] = 0, AVERAGE(Table1[2020 Forecast]), [2020 Forecast_]))
 

 But it doesn't work 😞

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @Anonymous 

try column

Column = if([2020 Forecast_]=0;average(Table1[2020 Forecast_]);[2020 Forecast_])

if you do not need a row context

and column

Column = if([2020 Forecast_]=0;calculate(average(Table1[2020 Forecast_]);ALL(Table1));[2020 Forecast_])

if you do need

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

Hi @Anonymous 

try column

Column = if([2020 Forecast_]=0;average(Table1[2020 Forecast_]);[2020 Forecast_])

if you do not need a row context

and column

Column = if([2020 Forecast_]=0;calculate(average(Table1[2020 Forecast_]);ALL(Table1));[2020 Forecast_])

if you do need

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Thanks @az38. I had to change the ; to a , but other than that, it worked well. Thank you!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.