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

NaN error

Hello all,

 

I keep getting this NaN error for this statement, and I am not sure why

 

Vol Growth '19-'20 = ('Img Div_Img'[2020 Vol]-'Img Div_Img'[2019 Vol])/'Img Div_Img'[2019 Vol]

 

I am trying to show growth % from 2019 Vol to 2020 Vol by doing 2020 vol minus 2019 vol, then divide that by 2019 vol to get the %

 

 

 

TIA!!

 

 

vol growth.PNG

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Anonymous ,

 

what exactly do you want to do?

For me it looks like these are all calculated columns. Calculated column are statis, that means they are created when the file is loaded and won't change anymore afterwards. For example when you use a slicer, it won't change the content of the column.

 

In your case the new calculated column [Vol Growth '19-'20] will perform the operation line by line once the file is loaded. I'm not really sure if you want that.

Usually you want the whole thing to be interactive. For that you would use a measure. If you create a measure the columns need aggregation. So as a measure you would write:

Vol Growth '19-'20 = ( SUM( 'Img Div_Img'[2020 Vol]) - SUM( 'Img Div_Img'[2019 Vol]) ) / SUM( 'Img Div_Img'[2019 Vol])

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
selimovd
Super User
Super User

Hey @Anonymous ,

 

what exactly do you want to do?

For me it looks like these are all calculated columns. Calculated column are statis, that means they are created when the file is loaded and won't change anymore afterwards. For example when you use a slicer, it won't change the content of the column.

 

In your case the new calculated column [Vol Growth '19-'20] will perform the operation line by line once the file is loaded. I'm not really sure if you want that.

Usually you want the whole thing to be interactive. For that you would use a measure. If you create a measure the columns need aggregation. So as a measure you would write:

Vol Growth '19-'20 = ( SUM( 'Img Div_Img'[2020 Vol]) - SUM( 'Img Div_Img'[2019 Vol]) ) / SUM( 'Img Div_Img'[2019 Vol])

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
amitchandak
Super User
Super User

@Anonymous , Try

Vol Growth '19-'20 = divide('Img Div_Img'[2020 Vol]-'Img Div_Img'[2019 Vol],'Img Div_Img'[2019 Vol])

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.