cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

[Seek Help] How to Lookup the value of previous date in the same column?

Hi Expert,

 

I have a table like beow which shows the status of the Task as of each week. 

I want to create a new column "Previous Week's Status" which lookup the previous week Status of the task.

Report Effective DateTaskStatusPrevious Week's Status
3/29/2019AWIP 
3/29/2019BWIP 
3/29/2019CWIP 
4/5/2019AWIPWIP
4/5/2019BWIPWIP
4/5/2019CDoneWIP
4/12/2019AWIPWIP
4/12/2019BDoneWIP
4/12/2019CDoneDone

 

Is it possible to achieve it by DAX?

 

Many thanks!

 

Best regards,

Tom

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User VII
Super User VII

Re: [Seek Help] How to Lookup the value of previous date in the same column?

@TomLU123 add following measure

 

Prev Week Status = 
VAR __prevDate = 
CALCULATE( 
    MAX( Table1[Report Effective Date] ),
    FILTER( 
        ALLEXCEPT( Table1, Table1[Task] ), 
        Table1[Report Effective Date] < MAX( Table1[Report Effective Date] )
    ) 
)
RETURN 
IF ( 
    ISBLANK ( __prevDate ), "", 
    CALCULATE( 
        MAX( Table1[Status] ), 
        ALLEXCEPT( Table1, Table1[Task] ), 
        Table1[Report Effective Date] = __prevDate ) 
)





Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

1 REPLY 1
Highlighted
Super User VII
Super User VII

Re: [Seek Help] How to Lookup the value of previous date in the same column?

@TomLU123 add following measure

 

Prev Week Status = 
VAR __prevDate = 
CALCULATE( 
    MAX( Table1[Report Effective Date] ),
    FILTER( 
        ALLEXCEPT( Table1, Table1[Task] ), 
        Table1[Report Effective Date] < MAX( Table1[Report Effective Date] )
    ) 
)
RETURN 
IF ( 
    ISBLANK ( __prevDate ), "", 
    CALCULATE( 
        MAX( Table1[Status] ), 
        ALLEXCEPT( Table1, Table1[Task] ), 
        Table1[Report Effective Date] = __prevDate ) 
)





Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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