Forum Discussion

31415926's avatar
31415926
New Member
4 years ago
Solved

Year to Year only show specific values

Hi,

 

I wanted to present the sales of 2021 and 2022 with YOY change %.

YOY = DIVIDE(([Total Sales This Year]-[Total Sales Last Year]),[Total Sales Last Year])

As you can see below, the YOY value is -100% since March because "total sales this year" is 0.

 

I wanted to only present the months that have an actual value in YOY % (in this case, Jan and Feb).

So I used a new measure: 

YOY % = CALCULATE([YOY],FILTER('2021&2022',[YOY]<>-1))
The new measure showed indeed only the first 2 months, however, with different and wrong values (174% en 1678%). I don't even know how these values come from.
 
Could you please help me check what went wrong? Or is there a better way to filter the values of YOY only?
Many thanks!

 

  • YOY % =
    var currentSales = [Total Sales This Year]
    var prevSales = [Total Sales Last Year]
    return IF( currentSales > 0, DIVIDE( currentSales - prevSales, prevSales ) )

    will only return a value if there are sales for this year, otherwise it will return blank

2 Replies

  • YOY % =
    var currentSales = [Total Sales This Year]
    var prevSales = [Total Sales Last Year]
    return IF( currentSales > 0, DIVIDE( currentSales - prevSales, prevSales ) )

    will only return a value if there are sales for this year, otherwise it will return blank