Forum Discussion
Inconsistent IF statement
Hi all, I have a simple IF statement which is returning inconsistent results and I can'T figure out why. I would greatly appreciate any help in this.
This is the IF statement where I want it to return a "YES" when the value is less than 24 else "NO".
| InboundTime(Hours) | KPI Achieved |
| 164 | YES |
| 2502 | NO |
| -1 | YES |
| 22 | YES |
| -1 | YES |
| 26 | NO |
| 26 | NO |
| 21 | YES |
| 145 | YES |
| 168 | YES |
| 50 | NO |
| 50 | NO |
| 1 | YES |
| 1 | YES |
| 50 | NO |
| 1517 | YES |
- Anonymous5 years ago
I would assume that the first column is not formatted correctly. Can you check that it's stored as whole number/decimal number?
4 Replies
- AnonymousNot applicable
I would assume that the first column is not formatted correctly. Can you check that it's stored as whole number/decimal number?
- eWise
Helper II
Anonymous , FrankAT I think that may be at the core of my woes. The column is a product of a datediff function. I reformmated my IF statement as IF('Inbound'[InboundTime(Hours)] <= 24 , "YES","NO") with a space after the 24 and it seems to be working, atleast for the sample data I have for now, it's returning concistent results.
- FrankAT
Community Champion
Hi eWise ,
you try an alphabetical compare of text "24", so your "inconsistent results" are in this term correct.
If you want a numerical compare you can do it like this:
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut) - eWise
Helper II
Unfortunately this did not work in my case.