Forum Discussion

AndySmith's avatar
AndySmith
Icon for Helper III rankHelper III
2 years ago
Solved

Prior Period dependent on Month Slicers

Hi   I have a sales table and a Date Table. I am using a Month Year Slicer.   Would like to calculate the sum of sales for the prior period based on this slicer. So if I have 1 month selected - I...
  • Ahmedx's avatar
    2 years ago

    Something like this
    you should have a date table

    Measure = 
    VAR CounMonth = DISTINCTCOUNT('Calendar'[Month Number])
    RETURN
    CALCULATE(SUM(yourtable[Sales]), DATEADD('Calendar'[Date],-CounMonth,MONTH))