cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Get date previous to the current row date

 

Hi, I want to get the previous date to what is available in my current row, I cannot use -1 or -2 as the Intervals are random.

I am doin this but it isn't helping

 

Prev_Date = CALCULATE(LASTDATE(TransactionForecast_Latest_Region[day]),FILTER(TransactionForecast_Latest_Region,TransactionForecast_Latest_Region[day]<MAX(TransactionForecast_Latest_Region[day])))

1 ACCEPTED SOLUTION
Memorable Member
Memorable Member

Is this a calculated column?

 

If so, you can try:

Prev_Date =
VAR _CurrentDate = TransactionForecast_Latest_Region[day]
RETURN
    CALCULATE (
        LASTDATE ( TransactionForecast_Latest_Region[day] ),
        FILTER (
            TransactionForecast_Latest_Region,
            TransactionForecast_Latest_Region[day] < _CurrentDay
        )
    )

 

A measure (assuming it has row context):

 

Prev_Date =
VAR _CurrentDate = FIRSTNONBLANK(TransactionForecast_Latest_Region[day],0)
RETURN
    CALCULATE (
        LASTDATE ( TransactionForecast_Latest_Region[day] )
            ,ALL(TransactionForecast_Latest_Region[day])
           , TransactionForecast_Latest_Region[day] < _CurrentDay
        )
    


Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



View solution in original post

1 REPLY 1
Memorable Member
Memorable Member

Is this a calculated column?

 

If so, you can try:

Prev_Date =
VAR _CurrentDate = TransactionForecast_Latest_Region[day]
RETURN
    CALCULATE (
        LASTDATE ( TransactionForecast_Latest_Region[day] ),
        FILTER (
            TransactionForecast_Latest_Region,
            TransactionForecast_Latest_Region[day] < _CurrentDay
        )
    )

 

A measure (assuming it has row context):

 

Prev_Date =
VAR _CurrentDate = FIRSTNONBLANK(TransactionForecast_Latest_Region[day],0)
RETURN
    CALCULATE (
        LASTDATE ( TransactionForecast_Latest_Region[day] )
            ,ALL(TransactionForecast_Latest_Region[day])
           , TransactionForecast_Latest_Region[day] < _CurrentDay
        )
    


Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



View solution in original post

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors