Cami
Cami

Reputation: 33

Get previous month value Power BI DAX

I have a table with the following measures and columns

enter image description here

the "net month" and "beginning balance" columns are measures, I want to get the "balance" column which is calculated as follows

and so on. Any ideas for a measure or function I can use?

Thank you very much in advance

Upvotes: 0

Views: 142

Answers (1)

Sam Nseir
Sam Nseir

Reputation: 12041

You will need a proper Date column, it can be set for the 1st day of the month.

Then your measure could look like this:

Balance = 
  var mnths =
    SUMMARIZE(
      FILTER('YourTable', [Date] <= MIN('YourTable'[Date])),
      "netM", [net month]
    )
  return [beginning balance] + SUMX(mnths, [netM])

Upvotes: 0

Related Questions