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! Request now

Reply
Anonymous
Not applicable

IF AND STATEMENT Measure Power Query

I have two columns: 1. predicted precipitation (Table1[Prediction]) and 2. actual precipitation (Table2[Real]) and I want to test 4 conditions:
a. predicted precipitation/observed precipitation
b. precipitation predicted/precipitation not observed
c. precipitation not forecasted/precipitation observed
d. unpredicted precipitation/unobserved precipitation

I tested this measure for option a:
IF(ISBLANK(Table1[Prediction]);BLANK();IF(AND(Table2[Actual] > 0;Table1[Prediction] > 0);0;1))

However, in cases where prediction is 0 and reality is 0.2, the result of the measure is 0, when it should be 1, because only one of the conditions is true.

I can't get over this obstacle.

I thank you in advance for your help.

 

1 ACCEPTED SOLUTION

Hi,

i hope this time it's good (i printed your solution to verify)

P = IF('Table'[Column1]=0,1,If(and('Table'[Column1]>=0,'Table'[Column2]>0),0,1))

serpiva64_0-1668166691092.png

 

View solution in original post

10 REPLIES 10
serpiva64
Solution Sage
Solution Sage

Please,

can you post an exemple of your tables and of expeted results?

Anonymous
Not applicable

Captura de ecrã 2022-11-11 104304.png

Thank you in advance for your interest in helping me. This is an example of my values, the result I expect to get and what, with the formula I posted initially, I am getting.

Hi,

try this 

P = IF(and('Table'[Column1]>=0,'Table'[Column2]>0),0,1)
(adapt , and columns name to your case)

 

serpiva64_0-1668164741115.png

If this post is useful to help you to solve your issue consider giving the post a thumbs up 

 and accepting it as a solution !

 

Anonymous
Not applicable

Thanks for the suggestion, but unfortunately it doesn't solve the issue I raised.
If you notice, in the case where the prediction is 0 and the reality is 0.2, the result should be "1" and not "0".

Sorry, 

to many 1 and 0!

try this

P = IF(and('Table'[Column1]=0,'Table'[Column2]=0),1,If(and('Table'[Column1]>=0,'Table'[Column2]>0),0,1))

serpiva64_0-1668165587368.png

 

Anonymous
Not applicable

Thank you for another suggestion. However, the result is the same. If you notice in the table you shared with me, the result is still "0" instead of "1".serpiva64_0-1668165587368.png

Hi,

i hope this time it's good (i printed your solution to verify)

P = IF('Table'[Column1]=0,1,If(and('Table'[Column1]>=0,'Table'[Column2]>0),0,1))

serpiva64_0-1668166691092.png

 

Anonymous
Not applicable

Thank you once again. I see that in your table, the formula works, but in mine, unfortunately not. I still get 0. I don't understand why.

Please post the new formula you are using

Anonymous
Not applicable

I already know why it didn't work and it's embarrassing. It wasn't a 0, but a 0.3 the prediction. I apologize for wasting your time. Thank you very much for your help.

Helpful resources

Announcements
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.