cancel
Showing results for
Did you mean:
Highlighted
Member

## NaN Error

Hi All,

I  have two columns , "Total Queries" & "Other blocked" and when i try to divide Other blocked / Total Queries is throwing NaN value when both columns has value 0. Hence unable to calculate the percentage for the same. Could anyone please help me with the NaN error .

Attaching sample where %  column should  actually result in 0.18 value  instead of  0.71

Pinky

1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

## Re: NaN Error

Hi @Pinky0404,

Thanks,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Regular Visitor

## Re: NaN Error

Hey there @Pinky0404!

You would probably be best with using the [b]DIVIDE[/b] function ( https://msdn.microsoft.com/en-us/library/jj677276.aspx ) where you could right something like:

`P% = DIVIDE([Other Blocked], [Total Queries], 0)`

Where you'd see a 0 in case [Total Queries] = 0. You simply then format the measure as a percentage in Modeling.

More, I see that you have [Other blocked] as a decimal, which I guess is redundant. I'd change it to whole number, you never know if DAX has any problems with dividing different types.

Hope this helps!

Member

## Re: NaN Error

Thanks for your response. I found an answer. i was directly dividing the columns  which was giving  the total % , rather calculating as sum(other blocked)/sum(total queries).

Super Contributor

## Re: NaN Error

Hi @Pinky0404,

Thanks,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

Power BI Super User, Greg Deckler, explains

#### Power Platform Summit North America

Register by September 5 to save \$200

#### Back to School Contest

Engage and empower students with Power BI!

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 106 members 1,604 guests
Recent signins: