Forum Discussion

sarikei's avatar
sarikei
Helper I
3 years ago

Previous Year

I have a slicer (Slicer A) display text of the date. i.e. Current Month, Current Year, Current Quarter.

Then I have the other slicer (Slicer B) display the actual date of it. example, if Slicer A is Current Month, then Slicer B will be Date From 01-02-2023 Date To 28-02-2023. If Slicer A is Current Year, then Slicer B is Date from 01-01-2023 Date To 01-12-2023.

All working fine, I have these 2 tables joined together in the data model.

Now, what I need to is to display the current and previous year Sales Revenue.

I can display the Current Year Sales Revenue. No problem, but I can’t display the Previous Year Sales Revenue.

The Previous Year Sales Revenue is a measure, using the following fomular:

 

Previous Year Sales Revenue = CALCULATE([# SalesRev], DATEADD(DateTable[Date],-1,YEAR)

 

The DateTable[Date] is what use to display the Slicer B. But this formular doesn’t look working.

Why? How can I display the value of this “DATEADD(DateTable[Date],-1,YEAR)” so I can analyse what is actually the value of it?

 

Please help.

2 Replies

  • sarikei , the measures seems fine

    Previous Year Sales Revenue = CALCULATE([# SalesRev], DATEADD(DateTable[Date],-1,YEAR))

     

    DateTable should have all the required date

    Join should be single directional

    DateTable should be marked as date table

     

    Slicer, visual should use DateTable for periods 

     

    Why Time Intelligence Fails - Powerbi 6 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4

    • sarikei's avatar
      sarikei
      Helper I

      yes, everything looks fine but the measure didn't work.

      the measure work only if I manually update the date in the Slicer B. Example, if I change the date manually as 01-12-2022 to 31-12-2022, then the previous year revenu will be calculated using 01-12-2021 to 31-12-2021, which is correct.

      What I miss? Why the measure not calculating unless I update the date manually on Slicer B?