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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

If function eith OR "||" in a measure in Tachometer to cover more than 2 condition

Hi,

I have a Tachometer that I need to define two conditions:

1- if Target+Actual = 0 then the gauge should be disappeared

2- if Actual > 1.15 * Target then it should be disappeared as well and this is when another Tachometer should kick in and show the status of it.

to achieve the two situation above I though of two Tachometers on top of each other. For the first one I defined following condition:

Alert = if ( [actual] < 1.15 * [target] || [target] + [actual] <> 0, 1, Blank()).

WhenI remove either of "[actual] < 1.15 * [target]" or "[target] + [actual] <> 0" it works perfectly and the gauge disapear as I wished but when putting them together in "Alert measure" like what I did above, it doesn't work . I have inspected the data types (i.e. evertything should be Whole number format) to make sure it works but still it is not working! Smiley Sad

Would appreciate your help!

27 REPLIES 27
Anonymous
Not applicable

Thanks @jdbuchanan71  for the reply,

The only thing is that for both actual and target I did following tricks to get rid of BLANK from my Actual and Target:

Actual = PreActual + 0 -> to convert blank to 0

Target = PreTarget + 0 -> to convert blank to 0.

Is it a better way to convert blank to 0 and avoid running in to the problem of following:

 2019-06-15_11-16-16.jpg2019-06-15_11-19-21.jpg

Thanks!

Can you show me the exact formula of the measure that is throwning the error, the one listed in the pop-up that you blanked out.

Anonymous
Not applicable

@jdbuchanan71  Thanks for the reply,

I have attached the screenshot of the error as per your request. the red arrow is showing the tachometer which should be shown instead of the error it's triggered. The measure is as you suggested above but you can see the error:

2019-06-15_19-14-34(1).jpg

@Anonymous It is going to be one of the measure you are feeding into your [Alert] measure that is resulting in the string, then when you try to comare it to a number in your alert measure it throws the error.

visualerror.jpg

Anonymous
Not applicable

Exactly @jdbuchanan71 ,

I have inspected all, they are all Whole Number and I re-did it to make sure none is not text string! How it else I can make sure they are not text?!

Without seeing the model, the best I can thing to do is use ISNUMBER checks around all three measures so your [Alert] measure ends up something like this:

Alert = 
VAR A = IF ( NOT ISNUMBER ( [Actual] ), 0, [Actual])
VAR B = IF ( NOT ISNUMBER ( [Target 1] ), 0, [Actual])
VAR C = IF ( NOT ISNUMBER ( [Other Target] ), 0, [Actual])

RETURN
IF ( A < 1.15 * B, 1, IF ( C <> 0, 1, BLANK()))

 

Anonymous
Not applicable

@jdbuchanan71  thanks!

I still am wondering why only when I run both of the conditions at the same time, the problem arises and not when one of them exists?

So, when I have:

Alert = if ( [actual] < 1.15 * [target] , 1, Blank()).

or when:

Alert = if (  [target] + [actual] <> 0, 1, Blank()).

it runs perfectly and no error kicks in!

Looking forward  to hearing your opinions

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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