Forum Discussion

ChrisCoxhill's avatar
ChrisCoxhill
Frequent Visitor
2 years ago
Solved

Previous Year comparison - account for partial current Year

Hi,   Please can I have assistance when trying to write DAX comparing to the prior year? When Month is in scope, and for full prior years, the calculation returns the appriopriate amount for "Prev...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ChrisCoxhill , amitchandak thank you for your prompt reply!
    Please try the following measure to show only the month totals for the same period last year:

    Previous Year 2 = CALCULATE(
       SUM('SW Energy'[Cost]),
       FILTER(
           SAMEPERIODLASTYEAR('Date'[Date]),
           MONTH('Date'[Date]) <= MONTH(MAX('SW Energy'[Invoice Date]))
       )
    )

     Result:

    Best regards,

     

    Joyce

     

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