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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

DAX IF Statement

I am new to writing DAX and trying to write the below IF statement:

 

Forecast/Actual= If TableX(actual amount) has a value, use TableX(actual amount) value. If TableX(actual amount) has no value, use Table Y(forecast amount)

 

No value meaning blank or 0.

 

Any help would be greatly appreciated! Thanks in advance

 

 

1 REPLY 1
kentyler
Solution Sage
Solution Sage

DAX offers the ISBLANK() function that you can use to solve part of your problem.

VAR replace = OR(IF( ISBLANK(TableX[actual amount]) ,  TableX[actual amount] =0)

RETURN IF(replace,tabley[forecast amount],tablex[actual amount])

 

this separates the test for whether or not you want to replace the value by using the OR function, if either of the arguments to OR is true it returns true.

If replace = true then you return the forecast, otherwise the actual





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors