Reputation: 71
The table is like the image:
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])
Upvotes: 5
Views: 13976
Reputation: 210
Try using the DIVIDE function instead of '/' operator. Ex: Test = DIVIDE(Col1,Col2)
Upvotes: 6
Reputation: 16908
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])
)
Upvotes: 2
Reputation: 13745
It is likely your SUM(Films[OscarNominations])
is returning 0, resulting in a divide by zero.
For your IFERROR
fix, right click on a field value in your visual and select "Show items with no data".
Alternatively, on error, return 0. It really depends on how you want your audience to interpret the data. In reality, it is Not A Number (NaN)...
Upvotes: 1