Hello Fellow Power BI Users -
I did a table for the product sales % growth comparison. I have noted that if the company sold this year but did not sell last year, the growth marging is blank. I am not sure about what I am missing.
I did the calculation based on the formula
Sales % Growth =
DIVIDE( [Sales Change] , [Total Sales LY] , 0 )
And this is what I got …
Any help will be really appreciated
Lucia
Do you really want a result?
To me this looks like what you need because in theory there is no answer to return.
What are you expecting as an answer here? Or alternatively what do you want?
To get something in there you will ultimately need to use simple IF logic.
IF( ISBLANK( Sales % Growth ), ...........................................
1 Like
Well, technically, if the company sells $100 this year vs. nothing last year, the sales growth should be 100% unless I am wrong in my statement …
Based on this, I created the following measure taking your hint.
Sales % Growth2 =
IF( ISBLANK( [Sales % Growth]), DIVIDE([Total Net Sales] , [Total Net Sales], 0) , DIVIDE( [Sales Change] , [Total Sales LY] , 0 ))
It seems like I’m getting the results I was looking for
What do you think?
Actually, while analizing the results, I realized that I also got blanks for the Sales Change values when there are sales in the current month but there’re not in the previous. I made a little modification to the original formula to get the results expected.
Sales Change2 =
IF( ISBLANK( [Total Sales LY] ), [Total Net Sales], [Total Net Sales] - [Total Sales LY] )
Maybe there’s a better way to do this?
Lucia
Seems to me that is likely the best way to solve this.
That’s what I would do.
Just want to make sure are you getting the results you want now?
When using the IF statement you can place anything in the answer. So if you need the 100% just insert that in the formula.
Chrs
1 Like
Yes, that’s exactly what I need.
Thank you for your help!!
Lucia
Hi Sam,
I tried a different approach to get the same result
Sales % Growth =
IF( ISBLANK( [Sales Change]), BLANK() , DIVIDE( [Sales Change] , [Total Sales LY] , 1 ))
I love all what I’m learning from your videos!
Chrs,
Lucia