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

Hiding/Blank : Infinity / NaN Error

Hey guys!

 

I am working with measures and I have got some Inifity / NaN Errors in my matrix which I want to show blank or hide them.

 

I usually use this measure for calculation:

 

 

SOTag Entw. = 
VAR __s = [SO/Tag 2020]/[SO/Tag 2019]
RETURN
IF ( __s  <> BLANK(), __s - 1 ) 

 

 

What do I need to add to those measures to blank those errors? Thanks!

1 ACCEPTED SOLUTION

Don't worry, you are just learning 🙂
I was talking about variables. Like this:

Entw.20 vs 19_DIOR = 
VAR _division = 
DIVIDE( 
    SUM('Jahr_Plan'[DIOR 20]),
    SUM(Jahr_Plan[DIOR 19]),
    BLANK()
) 
RETURN
IF(
    ISBLANK(_division),
    BLANK(),
    _division -1
)

Hope this time works !


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous ,

SOTag Entw. = divide([SO/Tag 2020],[SO/Tag 2019])

 

or

 

SOTag Entw. =
VAR __s = divide([SO/Tag 2020],[SO/Tag 2019])
RETURN
IF ( __s <> BLANK(), __s - 1 )

AllisonKennedy
Super User
Super User

The DIVIDE function will fix that for you

SOTag Entw. =
VAR __s =DIVIDE( [SO/Tag 2020], [SO/Tag 2019] )
RETURN
IF ( __s <> BLANK(), __s - 1 )

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

@AllisonKennedy @amitchandak 

 

I have tried both formulas, but the error still shows up 😞

 

SOTAG-Divide.png

Hi, I'm not sure about NaN because it sounds like that value is in the data before calculation. The problem with the formula is that you need to add a value in case of infinity or error for the division function. Like this:

DIVIDE(
    [SO/Tag 2020], [SO/Tag 2019]
    , BLANK()
)

That way it will return blank if the division contains an error or infinity.

 

Regards,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

@ibarrau 

 

Thank you, thats working!

 

Another additional question:

 

What formulare do I have to use, if I want a development in %?

 

So usually my formula was:

([SO/TAG 2020]/[SO/Tag 2019])-1 

 

But if I put it on the on of your whole formulare it shows me -100% for the blanks.

 

Thanks!

 

Regards

Good! Assuming that the division is in a variable called "_division" you can try this:

VAR _division = ...
RETURN
IF(
    ISBLANK(_division),
    BLANK(),
    _division - 1
)

That way you can keep blanks as blanks.

Regards, 


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

@ibarrau 

 

Thanks. I am not very sure how the formula has to look at the end for example for this formula:

Entw.20 vs 19_DIOR = 
divide( sum('Jahr_Plan'[DIOR 20]),sum(Jahr_Plan[DIOR 19]),blank()) -1

 

Sorry - I am so nooby 😣

Don't worry, you are just learning 🙂
I was talking about variables. Like this:

Entw.20 vs 19_DIOR = 
VAR _division = 
DIVIDE( 
    SUM('Jahr_Plan'[DIOR 20]),
    SUM(Jahr_Plan[DIOR 19]),
    BLANK()
) 
RETURN
IF(
    ISBLANK(_division),
    BLANK(),
    _division -1
)

Hope this time works !


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

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.