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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

IF statement set numeric value

I'm having a problem with a if statement.

It's seems simple but not or I'm making a mistake.
1 field (whole number) : Response tag

The new column is  

Status_SLA_Response = IF(VALUE([Response Tag])>0,0,1)
Status_SLA_Response is whole number

The problem is when [Response Tag] is 0, we get a blank result in the field Status__SLA_Response and we get the value 1 when [Response Tag] is positive ????? Not really the result expected !
What's wrong ?
 
1 ACCEPTED SOLUTION

@Anonymous  not ideal but can you +0 to the end of it and see if that fixes it?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




View solution in original post

9 REPLIES 9
Tahreem24
Super User
Super User

Hi @Anonymous ,

 

Please try using your expression with out VALUE keyword. I hope it will give you expected result.

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
vinaypugalia
Resolver I
Resolver I

Hello @Anonymous ,

 

This actually looks wierd. Might need more details though.

In the mean time, please try the below options - 

1.  IF([Response Tag]>0,0,1)

2. IF([Response Tag]<=0,1,0)

 

Hope, this will help!

vanessafvg
Super User
Super User

@Anonymous  what data type is the responsetag?

 

can you paste some of your data, i have tried to replicate your issue but not coming up with the same problem, wondering if its an underlying issue in your data





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

Here is a sample of my data


1.
Response target
20/01/2019 16:00:00
Response Stop
27/01/2019 05:05:05
Response Tag : -2095
= IF([ResponseTargetDate]<>BLANK(),DATEDIFF([ResponseTargetDate],[ResponseSLAStoppedDate],MINUTE),0)


Status_SLA_Response: 0

=IF([Response Tag]<0,1,0)
 
2.
Response target
28/01/2019 16:00:00
Response Stop
28/01/2019 20:31:40
Response Tag : 271
Status_SLA_Response: Blank
 
Could not find the mistake !

i have put your data into a model and  am not experiencing what you are

 

see attached, how does this differ from what you doing @Anonymous 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

Thx Vanessa,

 

It's exactly what I'm doing.
To get the wrong result, I put the cursor to the rigth of the formula 

Status_SLA_Response = IF([ResponseTag]<0,1,0) and click en the Enter key.

0 remains 0 and 1 becomes blank Smiley Sad

I tried this
Status_SLA_Response =
SWITCH(
[ResponseTag]<0,5,
[ResponseTag]>=0,0,0
)
But same problem, only the 0 value is displayed.

@Anonymous  and if you open my power bi, does it look correct?  does it show the right  values?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

Yes, it shows the right result but when a click on the Entre key just after the formula, it becomes wrong also.
It seems to be a problem with the IF statement because only the first <value_if_true> is displayed.
If I change to IF([Response Tag]<0,1,0), I get ones and blanks.
With IF([Response Tag]<0,0,1), I get zeros and blanks.

@Anonymous  not ideal but can you +0 to the end of it and see if that fixes it?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.