Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

i need to replace NaN with blank space where the operation fails in dax power bi

Tags:

powerbi

dax

The table is like the image:

enter image description here

I need to keep the NaN as empty but when I use IFERROR() and put blank() in the ValueifError it just deletes the entire row which I dont want. Is there any way to replace NaN with a blank space

I used the dax below: oscar wins = SUM(Films[OscarWins])/SUM(Films[OscarNominations])

like image 493
jjah Avatar asked Mar 02 '23 01:03

jjah


2 Answers

Try using the DIVIDE function instead of '/' operator. Ex: Test = DIVIDE(Col1,Col2)

like image 148
Priyanka2304 Avatar answered Apr 30 '23 22:04

Priyanka2304


You can handle the case when denominator is 0 as below. This will simply check, if the denominator is 0, it will return BLANK(). Other case it will return the result from normal calculation.

oscar wins = 
IF(
    SUM(Films[OscarNominations]) = 0,
    BLANK(),
    SUM(Films[OscarWins])/SUM(Films[OscarNominations])
)
like image 25
mkRabbani Avatar answered Apr 30 '23 22:04

mkRabbani