cancel
Showing results for
Did you mean:
Frequent Visitor

## Display Last month and December Last Year

Hi everyone,

I am trying to build a balance sheet in a matrix visual showing the last month (i.e. October 2022 results) compared with December values of last year (i.e. December 2021) with the header reflecting Month & Year.

I have a date table with a date column marked as date.

I managed to calculate latest month and December last year's value through the following formulas.

#### Total Amount Last Date = CALCULATE([Total Amount BS],LASTDATE('BS'[Date]))

The desired outcome is to get the result to work in one measure. Appreciate the help!

1 ACCEPTED SOLUTION
Super User

@Peter_Yaacoub , Try measure like

Last Month Today =
var _min = eomonth(today(),-2)+1
var _max = eomonth(today(),-1)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

Last Month Last year Today =
var _min = eomonth(today(),-1*month(Today())-1)+1
var _max = eomonth(today(),-1*month(Today()))
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27...

Super User

@Peter_Yaacoub , Try measure like

Last Month Today =
var _min = eomonth(today(),-2)+1
var _max = eomonth(today(),-1)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

Last Month Last year Today =
var _min = eomonth(today(),-1*month(Today())-1)+1
var _max = eomonth(today(),-1*month(Today()))
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27...

Announcements

#### Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

#### Power BI March 2023 Update

Find out more about the March 2023 update.

#### March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors
Top Kudoed Authors