cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dcunningham27 Regular Visitor
Regular Visitor

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

Accepted Solutions
Super User II
Super User II

Re: Create DAX measure from Excel Formula

Hi @dcunningham27 

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
Super User II
Super User II

Re: Create DAX measure from Excel Formula

Hi @dcunningham27 

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

dcunningham27 Regular Visitor
Regular Visitor

Re: Create DAX measure from Excel Formula

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

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Users online (1,169)