Forum Discussion

sailesh_kumar's avatar
sailesh_kumar
Frequent Visitor
4 years ago
Solved

Year on Year Sales Comparision

Hello All. I am currently working on a data set which has billing date and Financial year ... If Financial Year 2023 is selected it has to show the last 5 year sales and it has to compare the sales . I have data for FY 2020,2021 ,2022and 2 months of FY 2023. I have to show the comparision line of 2 months of FY 2023 with respect to the same months in the previous year . Currently it compares the partial data of 2023 with full year of 2022

The DAx I have written is 

Revenue =
CALCULATE(SUM(Data[NetSales]),
filter('Calendar','Calendar'[Date] <= [stop date]))
 
Previous year =
var v_currentyear = MAX(Data[Financialyear])
return CALCULATE(SUM(Data[NetSales]),value(Data[Financialyear]) = value(v_currentyear-1))
 
Year on YEar % change =
VAR _YOYValue = [Revenue] - [Py1]
RETURN
DIVIDE(_YOYValue,[Py1],0
)
 
stop date = max('Disconnected Calendar'[Date])
 
Please help.. CUrrently it compares partial data of this year with full data of last year.. It has to compare partial data of this year with the corresponding data of previous year
 
Here is the data model
 

 

Relationships:

 

 

  • Icey's avatar
    Icey
    4 years ago

    Hi sailesh_kumar ,

     

    In your measures, try to also add another filter of month. Both year=currentyear-1 and month in currentmonths.

     

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • You can get a like for like comparison with

    Revenue prev year = CALCULATE( [Revenue], DATEADD('Date'[Date], -1, YEAR))
    • sailesh_kumar's avatar
      sailesh_kumar
      Frequent Visitor

      I tried this and using this gives the year on year comparision as a flat line... This issue is arising mainly because the requirement is based on financial date as slicer 

      • Icey's avatar
        Icey
        Icon for Community Support rankCommunity Support

        Hi sailesh_kumar ,

         

        In your measures, try to also add another filter of month. Both year=currentyear-1 and month in currentmonths.

         

         

        Best Regards,

        Icey

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.