Forum Discussion

nleuck's avatar
nleuck
Post Patron
6 years ago
Solved

SAMEPERIODLASTYEAR issues Direct Query

Hello All,   I'm having some trouble with the function SAMEPERIODLASTYEAR and slicer not displaying. I went through a few different stages and thought I would explain them to show you how I got to ...
  • nleuck's avatar
    6 years ago

    I found a solution that seems to work.

     

    In my date calendar I create a flag for future date column (below the formula is a video that was very helpful) :

     

    Future Date Flag = IF(Calendar[Date] > TODAY(), "Future", "Past")

     

    https://www.youtube.com/watch?v=XjVLaVLluYE&list=PL7GQQXV5Z8eczWqKFMDVoHMjTcpH3tgZm&index=3 

     

    I applied that as a filter for my visual card for Same Period Last Year Sales and only select "Past" (below is my measure for the value that the card displays):

     

    Same Period Last Year = CALCULATE(SUM(Table[Sales]), SAMEPERIODLASTYEAR(Calendar[Date])

     

    The visual works as expected even when I select a different manager. No more error...hopefully!