Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Lead Lag Dax in Power BI desktop

Hello,

 

I need help in creating a dax to get date assigned and date reassigned to users according to the unique work ID.

This is how the table looks like now:

Unique IDDate AssignedUser
121/05/2020Tom
129/05/2020Rick
221/05/2020Dan
210/06/2020Rick
321/05/2020Tom
329/05/2020Rick
310/06/2020Dan

 

I want to get a date reassigned column which should be the assigned date of the next person for the same unique id:

Unique IDDateUserDate reassigned
121/05/2020Tom29/05/2020
129/05/2020Ricknull
221/05/2020Dan10/06/2020
210/06/2020Ricknull
321/05/2020Tom29/05/2020
329/05/2020Rick10/06/2020
310/06/2020Dannull

 

Thanks.

1 ACCEPTED SOLUTION

@Anonymous I didn't check if @amitchandak  solution will work or not but I will avoid using FILTER function as it can be a performance hit when you are working on a large dataset.

 

You can use following to add measure or column

 

Column = 
VAR __date = CALCULATE ( MAX ( Data[Date Assigned] ) )
RETURN 
CALCULATE ( 
    MIN ( Data[Date Assigned] ), 
    ALLEXCEPT ( Data, Data[Unique ID] ), 
    Data[Date Assigned] > __date 
) 

Measure  = 
VAR __date = MAX ( Data[Date Assigned] )
RETURN 
CALCULATE ( 
    MIN ( Data[Date Assigned] ), 
    ALLEXCEPT ( Data, Data[Unique ID] ), 
    Data[Date Assigned] > __date 
) 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Try a new measure like

Date reassigned=
calculate(max(Table[Date Assigned]), filter(All(Table) , Table[Unique ID]=max(Table[Unique ID]) && Table[Date Assigned]>max(Table[Date Assigned])))

@Anonymous I didn't check if @amitchandak  solution will work or not but I will avoid using FILTER function as it can be a performance hit when you are working on a large dataset.

 

You can use following to add measure or column

 

Column = 
VAR __date = CALCULATE ( MAX ( Data[Date Assigned] ) )
RETURN 
CALCULATE ( 
    MIN ( Data[Date Assigned] ), 
    ALLEXCEPT ( Data, Data[Unique ID] ), 
    Data[Date Assigned] > __date 
) 

Measure  = 
VAR __date = MAX ( Data[Date Assigned] )
RETURN 
CALCULATE ( 
    MIN ( Data[Date Assigned] ), 
    ALLEXCEPT ( Data, Data[Unique ID] ), 
    Data[Date Assigned] > __date 
) 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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.

parry2k
Super User
Super User

@Anonymous what defines the next person, is it alphabet or what or in the order you shown the data? Have to have some way of sorting to define the next person.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


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.

Anonymous
Not applicable

@parry2k  sorting by the unique ID and date assigned is good to get the next reassigned date.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.