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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
DavidBlockAU
New Member

Look up value in different row and return row in Query editor

I have done some searching and found a few posts close to what I'm after, but can't quite get the result I need! In particular, this was real close. 

 

I have a table like this (date format is DDMMYYYY):

JobNoStageIDTargetDateActualDate
1210001/01/202002/01/2020
1220007/01/202006/01/2020
1230014/01/202010/01/2020
1240031/01/202021/01/2020
2810003/01/202003/01/2020
2820005/01/202007/01/2020
2840015/01/202021/01/2020
2850020/01/202030/01/2020

 

I want to return the "Scheduled Start Date" for a particular job (being the target date where StageID = 100 for a job) in a separate column in query editor so my table will look something like this:

 

JobNoStageIDTargetDateActualDateStartDate
1210001/01/202002/01/202001/01/2020
1220007/01/202006/01/202001/01/2020
1230014/01/202010/01/202001/01/2020
1240031/01/202021/01/202001/01/2020
2810003/01/202003/01/202003/01/2020
2820005/01/202007/01/202003/01/2020
2840015/01/202021/01/202003/01/2020
2850020/01/202030/01/202003/01/2020

 

Any help would be much appreciated!

1 ACCEPTED SOLUTION
rajulshah
Resident Rockstar
Resident Rockstar

Hello @DavidBlockAU,

You can try the following steps:

1. Create a duplicate of the table. Go to that duplicate table.

2. Go to Transform > Group By. Enter JobNo as Grouping, New column name - 'StartDate', Operation - 'Min' & Column - 'TargetDate'. Click on OK.
3. Go to the original table > Merge Queries. Merge original and duplicate table with JobNo column.

4. Expand the column and select only 'StartDate. You will have your column.

 

Hope this helps.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Make sure it is a date column, detected by power BI. I created the following two

 

 

Target Date New = mid(schedulestartdate[TargetDate],4,2) &"/"& left(schedulestartdate[TargetDate],2) & "/" & right(schedulestartdate[TargetDate],4)

start Date= LOOKUPVALUE(schedulestartdate[Target Date New],schedulestartdate[JobNo],FIRSTNONBLANK(schedulestartdate[JobNo],TRUE()),schedulestartdate[StageID],100,FIRSTNONBLANK(schedulestartdate[Target Date New],TRUE()))

 

 

Refer : https://www.dropbox.com/s/bours0j29rwyy3o/schedulestartdate.pbix?dl=0

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
rajulshah
Resident Rockstar
Resident Rockstar

Hello @DavidBlockAU,

You can try the following steps:

1. Create a duplicate of the table. Go to that duplicate table.

2. Go to Transform > Group By. Enter JobNo as Grouping, New column name - 'StartDate', Operation - 'Min' & Column - 'TargetDate'. Click on OK.
3. Go to the original table > Merge Queries. Merge original and duplicate table with JobNo column.

4. Expand the column and select only 'StartDate. You will have your column.

 

Hope this helps.

Can't believe I didn't think to do this, already have 3 merges in the model! Thanks for the suggestion @rajulshah!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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