Forum Discussion
If OR statement - what am i doing wrong?
- 9 months ago
pls see if this works for you
% Variance FC vs PY =
VAR MetricType = SELECTEDVALUE('Results (2)'[Period])
VAR FC = SELECTEDVALUE('Results (2)'[MTD FC])
VAR PY = SELECTEDVALUE('Results (2)'[MTD PY])
RETURN
IF(
OR(MetricType = "Percentage", MetricType = "Ratio"),
"-",
FORMAT(DIVIDE(FC - PY, PY), "0%;(0%)")
)if this does not work, pls provide some sample data and expected output.
Hi EvaHello
What do you expect "-" to return? Using this simply results a literal string. You also mentioned absolute difference but there isn't anything in your formula that indicates it. It would be easier for us to figure out what you're trying to achieve had you provided a sample data and your epxected result. Please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud.
Hi - id like to adjust the formula so that if its a cost, the variance takes account of negatives
Current formula:
| Budget | Forecast | Variance | What I want it to show | |
| Rev | 405.3 | 383.7 | 6% | 6% |
| Cost | -8 | -15 | -47% | 47% |
| Profit | 397.3 | 368.7 | 8% | 8% |