Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Create New Column Referencing Prev Month Row

Hello,

 

I am trying to create a column in Power BI that will  be equal to the the value for the same item one month ago.

 

The LastMonths Balance is the new column and needs to be equal to the balance for the same category last month.

 

DateCategoryBalance

LastMonths Balance (New Column)

11/30/21

    1

1000null
12/31/21    22000null
1/31/21    33000null
11/30/21    115001000
12/31/21    225002000
1/31/21    335003000
  • @ , Try a new column like


    new column =
    var _item = [category]
    var _date = eomonth([date],-1)
    return
    sumx(filter(Table, [category] =_item && eomonth([date],0) = _date), [Balance])

1 Reply

  • @ , Try a new column like


    new column =
    var _item = [category]
    var _date = eomonth([date],-1)
    return
    sumx(filter(Table, [category] =_item && eomonth([date],0) = _date), [Balance])