How to calculate percentage when old value is ZERO

后端 未结 9 1056
甜味超标
甜味超标 2021-01-31 16:20

I need the logic for the following situation. I am clueless in doing this.

Consider for January I have 10$ revenue and f

9条回答
  •  萌比男神i
    2021-01-31 17:07

    If you're required to show growth as a percentage it's customary to display [NaN] or something similar in these cases. A growth rate, on the other hand, would be reported in this case as $/month. So in your example for April the growth rate would be calculated as ((20-0)/1.

    In any event, determining the correct method for reporting this special case is a user decision. Is it covered in your user requirements?

提交回复
热议问题