cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eWise
Frequent Visitor

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

KPI Achieved = IF('Inbound'[InboundTime(Hours)] <= "24", "YES","NO")
 
These are the inconsistent results
InboundTime(Hours)KPI Achieved
164YES
2502NO
-1YES
22YES
-1YES
26NO
26NO
21YES
145YES
168YES
50NO
50NO
1YES
1YES
50NO
1517YES
1 ACCEPTED SOLUTION
zhivana
Frequent Visitor

I would assume that the first column is not formatted correctly. Can you check that it's stored as whole number/decimal number?

View solution in original post

4 REPLIES 4
zhivana
Frequent Visitor

I would assume that the first column is not formatted correctly. Can you check that it's stored as whole number/decimal number?

View solution in original post

eWise
Frequent Visitor

@zhivana , @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.

 

eWise
Frequent Visitor

Unfortunately this did not work in my case.

 

 

FrankAT
Super User II
Super User II

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:

 

15-05-_2021_00-14-50.png

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors