Forum Discussion

jlandsm4785's avatar
jlandsm4785
Frequent Visitor
4 years ago
Solved

Previous Year Sales Calculation Issue

Hello,   I am trying to create a measure to show last year's sales which i will use to calculate YoY growth. When i put this in a table format i can tell there is an issue because the LY values do ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  jlandsm4785 ,

    I created some data:

    Here are the steps you can follow:

    1. Create measure.

    LY =
    CALCULATE(
        SUM('Table'[Amount]),FILTER(ALL('Table'),
        'Table'[Date]>=DATE(YEAR(MAX('Table'[Date]))-1,1,1)&&'Table'[Date]<=DATE(YEAR(MAX('Table'[Date]))-1,MONTH(MAX('Table'[Date])),DAY(MAX('Table'[Date])))
    ))
    CY =
    CALCULATE(
        SUM('Table'[Amount]),FILTER(ALL('Table'),
        'Table'[Date]>=DATE(YEAR(MAX('Table'[Date])),1,1)&&'Table'[Date]<=MAX('Table'[Date])))

    2. Result:

    If you need pbix, please click here.

     

    Best Regards,

    Liu Yang

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