Forum Discussion

SGBaringa's avatar
SGBaringa
Frequent Visitor
2 years ago
Solved

Previous year value based on year integer slicer

Hello PBI Community,   I am having a hard time trying to figure out a solution for a seemilngly simple case.   What I have are two tables, Calendar and Sales. Calendar contains only one column wh...
  • rajendraongole1's avatar
    2 years ago

    Hi SGBaringa - you are getting that issue because of the filter context applied on slicer calender entity.

     

    can you check the below formaule:

    PreviousYearRevenue =
    VAR SelectedYear = SELECTEDVALUE('Calendar'[Year])
    VAR PreviousYear = SelectedYear - 1
    RETURN
    CALCULATE(
    SUM('Sales'[Revenue]),
    'Sales'[Period] = PreviousYear,
    ALL('Calendar')
    )

     

    It works.