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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
AutyDA
Helper I
Helper I

IF function with > returning random results

I have a measure which based upon a series of IF functions uses CONCATENATE to develop a text statement. It all works except for one IF statement that asks if a measure (SELECTEDCOMPANY[Revenue_LastDate_%ofPeers]) is greater than a second measure SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers] to return some text if TRUE and a different text if FALSE. My prolem is sometimes the IF statement is returning TRUE when its actually FALSE and it appears random. Any ideas of why this could be happening?

 

I've copied the relevant part of my measure below:-

 

IF(SELECTEDCOMPANY[Revenue_LastDate_%ofPeers]>SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers], " It's position strengthened relative to its peers " " It's position weakened relative to its peers ")

 

1 ACCEPTED SOLUTION
AutyDA
Helper I
Helper I

I've solved the problem. The input measures for the IF statement were formatted as text rather than a number. By resolving this the IF statement is behaving normally.

 

Thanks.

View solution in original post

3 REPLIES 3
AutyDA
Helper I
Helper I

I've solved the problem. The input measures for the IF statement were formatted as text rather than a number. By resolving this the IF statement is behaving normally.

 

Thanks.

Uzi2019
Super User
Super User

Hi @AutyDA 

Can you share the sample data ?? what is 

SELECTEDCOMPANY[Revenue_LastDate_%ofPeers]
SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers]

two columns presenting data..

 

 

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

SELECTEDCOMPANY[Revenue_LastDate_%ofPeers] and SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers] are both measures in a table which is being filtered by various slicers. Each of these producers a % which works correctly. Each returns the % of revenue a selected company is responsible from the total revenue of several companies at a specific date. 

 

An example of a what I'm getting is (red text added for clarity) - 

 

SELECTEDCOMPANY[Revenue_LastDate_%ofPeers] = 13.23%
SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers] = 9.67%

 

And the if statement ...

 

IF(SELECTEDCOMPANY[Revenue_LastDate_%ofPeers] 13.23% >SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers] 9.67% , " It's position strengthened relative to its peers " , " It's position weakened relative to its peers ")

 

The result should be result... " It's position strengthened relative to its peers " but it's returning "It's position weakened relative to its peers"

 

Here are some examples of other results I get based upon the two measures (SELECTEDCOMPANY[Revenue_LastDate_%ofPeers] and SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers]) which shows the ranom results I am getting:

 

Revenue_FirstDate_%ofPeerRevenue_LastDate_%ofPeerIf statement returnsShould return
13.2310.1WeakenedWeakened
13.239.05StrengthenedWeakened
10.599.05StrengthenedWeakened
10.5911.32StrengthenedStrengthened
9.6711.25WeakenedStrengthened
9.679.5WeakenedWeakened
9.6710.1WeakenedStrengthened

 

Any ideas?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.