Forum Discussion

iblock's avatar
iblock
Frequent Visitor
3 years ago

Prior Year Sum in Column

I am trying to create a column that will calculate the sum of "Weighting Base" but for the prior year.  As you can see, it is returning only blank values right now.  It should, for example, show 5.68M for the 2016 row.  The Contract Year and Weighted Base are columns in my data.

3 Replies

  • DOLEARY85's avatar
    DOLEARY85
    Resident Rockstar

    Hi,

     

    try:

     

    CALCULATE(sum('Table'[Sum_field]),DATEADD('Table'[Date],-1,Year))
     
    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

  • iblock's avatar
    iblock
    Frequent Visitor

    I only have Contract Year (not the full date) and it is of type Whole Number, so the DATEADD function does not work here.

    • DOLEARY85's avatar
      DOLEARY85
      Resident Rockstar

      ah okay, try this:

       

      CALCULATE(MAX('Table'[Sum Field]),FILTER('Table','Table'[Year Field]=EARLIER('Table'[Year Field])-1))