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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tony1
New Member

NaN error in Power BI Matrix

Hi All

 

I have a matrix visual with values that are numbers formated as text using the FORMAT() function.  It works fine on PBI Desktop, but when I  publish to the web, it shows several NaN errors.  Why would this happen and how can I fix it?

 

This is one of the measures in the matrix:

Primary =
SWITCH( TRUE() ,
    ISBLANK( [Primary Calc 2] ) , BLANK(),
    MAX( Denomination[Index] ) = 4, FORMAT( [Primary Calc 2] , "#,##0.00 ;(#,##0.00);-  " ),
    MIN( Denomination[Denominator] ) = 1, FORMAT( [Primary Calc 2] , "#,##0 ;(#,##0);-  " ),
    MIN( Denomination[Denominator] ) = 1000, FORMAT( [Primary Calc 2] , "#,##0 ;(#,##0);-  " ),
    MIN( Denomination[Denominator] ) = 1000000, FORMAT( [Primary Calc 2] , "#,##0.0 ;(#,##0.0);-  " ),
    [Primary Calc 2]
)

 

Thank you for your help!

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @tony1,

 

I tested the same FORMAT formula, I didn't get NaN errors after publishing to service.

 

In your scenario, if you don't format the numeric values as Text, will issue persist in service? For further analysis, please post sample data and the DAX formula of [Primary Calc 2] and show us how is the Matrix look like. If possible, you could share your .pbix file.

 

Regards,

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.

Hi Yuliana

 

Thank you for your response.  I couldn't format the values as anything other than text.  

 

After playing around with the slicers on the report I realised that the issue arises when the number formatted is less than 1,000 and greater than zero.

 

Unfortunately, the pbix file contains sensitive data so I can't share publicly, but I could send it to you.

 

Regards

Tony

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.