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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

IF function bug when comparing a Measure to text

Hello,

 

I used this formula 100 times already and now it seems to not work anymore.

 

Basically what I do is creating this formula as a start

 

Market Selected = SELECTEDVALUE('Cost Center'[Market] ; "ESL Group")

So it retrieves the name of the Market I selected, and if nothing is selected then ESL Group.

 

Then using this next formula allows me to switch between 2 metrics.

 

Amount MC AC Rates = if([Market selected] = "ESL Group" ; [CHF AC GC Argo CC Integra Argo AY Rates] ; [MC AC CCamount conversion Argo AY Rates])

 

But the result is always false even if I m sure the Market Selected function is working. (I tested it on a visual)

 

Any idea if its my mistake or a Bug? Since I used this technic many time it really seems to me that its a bug.

 

Best regards

 

Mark Lovejoy

 

 

Status: New
Comments
v-qiuyu-msft
Community Support

Hi @Anonymous,

 

Based on my test in Power BI desktop version 2.65.5313.841 64-bit (December 2018), create measures below: 

 

SelectedValue = SELECTEDVALUE(Table1[Item],"a")
IfLogic = IF([SelectedValue]="a",1,0)

 

It's able to return 1 or 0 based on SelectedValue measure, see: 

 

w4.PNGw5.PNG

 

In your scenario, it looks like [CHF AC GC Argo CC Integra Argo AY Rates] and [MC AC CCamount conversion Argo AY Rates] are two measures, I would suggest you drag these two measures into separate card visual, then select value in slicer or dn't select any value to see if result of these two measures are the same. 

 

Also please run the latest Power BI desktop version as ours. You can also test with our sample file on your side to see if the same issue occurs. 

 

Best Regards,
Qiuyun Yu 

Anonymous
Not applicable

Hello Qiuyun

 

Thank you for your comment, I think I found the source of issue, but not how to resolve it :s

,

I have an issue with the use of the IF statement. (Well not really the IF since its more a visual problem. See print screen attach:
1- Is the amount in CHF that should appear in 2
2- Is this formula // Amount MC AC Rates = IF([Market selected] = “ESL Group” ; [CHF AC GC Argo CC Integra Argo AY Rates] ;[MC AC CCamount conversion Argo AY Rates]) //
3- The Market Criteria in the visual.

 

 

I m using this formula so that if no market is selected we get “ESL Group” which should lead then to use the [CHF AC GC Argo CC Integra Argo AY Rates] from the previous IF measure.

Market Selected = SELECTEDVALUE(‘Cost Center’[Market] ; “ESL Group”)

But, since the Market is in the SELECTEDVALUE measure and in the Visual, I always get a false to my IF function.

I tried to remove the filter with the All measure but then it doesn’t split by market in my visual (Same amount for all markets)

The point here is really to get the data of the Group in CHF by market, but then be able to filter a market and get the amount in SEK for Sweden (for exmemple)

Any ideas :blush:

Regards

 

Mark Lovejoy

v-qiuyu-msft
Community Support

Hi @Anonymous,

 

Is it possible to share pbix file? If it is, you can upload it to your Onedirve and send the share ink to me via private message. 

 

Best Regards,
Qiuyun Yu