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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors