Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

SamePeriodLastYear

Hello,

 

I have a measure -- Net_Sales_SPLY = Calcuate(Sum('Table'[SalesAmt]), SAMEPERIODLASTYEAR('CalendarTable'[Date]))

and get the following error every so often.

Not able to fully understand the error message or solve the issue.

I have also tried DateAdd -1 Year - but not able to solve the problem.  

Will greatly appreciate some input.

Many thanks,

Pavan

 

 

 

 

 

 

8 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks amitchandak.

      It is not breaking any more, but the numbers don't seem right.

      I should have mentioned earlier that the date in the Table[Sales Amt] is a week ending date, and the date in the Calendar table is a daily date.  Not sure if this matters or not.

      Thanks again!

      • amitchandak's avatar
        amitchandak
        Super User

        Anonymous , the Same week can fall in a different month. Unless you have 445 calendar. But based on weekend date falling in month total should be correct

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 

    you may try

    Net_Sales_SPLY =
    CALCULATE (
        SUM ( 'Table'[SalesAmt] ),
        SAMEPERIODLASTYEAR ( 'CalendarTable'[Date] ),
        CROSSFILTER ( 'Table'[Date], 'CalendarTable'[Date], 3 )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks tamerj1.

      It is not breaking any more, but the numbers don't seem right.

      I should have mentioned earlier that the date in the Table[Sales Amt] is a week ending date, and the date in the Calendar table is a daily date.  Not sure if this matters or not.

      Thanks again!

      • tamerj1's avatar
        tamerj1
        Community Champion

        Hi Anonymous 
        Would you please share a screenshot of your table visual?