Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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!!

 

 

  • 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
     

2 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    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
     
  • Anonymous , Try

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