Forum Discussion
IF function with > returning random results
- 1 year ago
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.
Hi AutyDA
Can you share the sample data ?? what is
SELECTEDCOMPANY[Revenue_LastDate_%ofPeers]
SELECTEDCOMPANY[Revenue_FirstDate_%ofPeers]
two columns presenting data..
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_%ofPeer | Revenue_LastDate_%ofPeer | If statement returns | Should return |
| 13.23 | 10.1 | Weakened | Weakened |
| 13.23 | 9.05 | Strengthened | Weakened |
| 10.59 | 9.05 | Strengthened | Weakened |
| 10.59 | 11.32 | Strengthened | Strengthened |
| 9.67 | 11.25 | Weakened | Strengthened |
| 9.67 | 9.5 | Weakened | Weakened |
| 9.67 | 10.1 | Weakened | Strengthened |
Any ideas?