Forum Discussion

AJ007's avatar
AJ007
Helper I
8 years ago
Solved

SamePeriodLastYear is blank

I have a dataset with column for years and another column for unemployment rate. I want to calculate the difference year over year. I tried SamePeriodLastYear but it's giving me blank output.

 

I have done lots of tricks to get a dates column as the original dataset didn't have a dates column but only the years column.

 

Please help.

  • It works for me.  Note there was one wtone shaped bracket in the orginal formula I posted

     

5 Replies

  • MattAllington's avatar
    MattAllington
    Community Champion

    Assuming you have a year column and a value column

     

    this year = sum(table[value])

    last year = calculate([this year],filter(all(table[year]),table[year]=max(table[year))-1))

    • AJ007's avatar
      AJ007
      Helper I

      Thanks Matt,

       

      I will test it and let you know. Thanks again.

    • AJ007's avatar
      AJ007
      Helper I

      Sorry it didn't work.

       

      This is my test data

       

       

       

      • MattAllington's avatar
        MattAllington
        Community Champion

        It works for me.  Note there was one wtone shaped bracket in the orginal formula I posted