I assume you have a date dim table in the model.
Please check the below picture and the attached pbix file. I tired to create a sample pbix file like below.
I hope the below can provide some ideas on how to create a solution for your datamodel.
Prev month value measure: =
VAR _prevmonthdate =
CALCULATE ( MAX ( 'Calendar'[Date] ), DATEADD ( 'Calendar'[Date], -1, MONTH ) )
VAR _alldatesbeforeprevmonthdate =
FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= _prevmonthdate ),
"@value", [Value measure:]
VAR _nonblankvaluelatestdatebeforeprevmonthdate =
FILTER ( _alldatesbeforeprevmonthdate, [@value] <> BLANK () ),
NOT ISBLANK ( [Value measure:] ),
'Calendar'[Date] = _nonblankvaluelatestdatebeforeprevmonthdate
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Go to My LinkedIn Page