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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
dataguy254
New Member

Returning original values in Power Query

Hello all,

 

I recently ran into an issue that I was able to fix using some DAX language, but it is causing a lot of issues with load times.

In the below table I have some sample data. The ID field is the ID for the specific person, the appID is an application they submitted, jobID is the position they applied to, and from is a linking of the jobID. As we can see, ID 1 applied to jobID 900, which is from jobID 213, jobID 213 is from 100, so on and so forth until we reach jobID 617, which is does not have a from value, meaning it is the original.

 

IDappIDjobIDfrom
1400900213
1401213100
1402100500
1403500617
1404617 
278176496
278296528
2783528 

 

 

What I would like to get is a column that gives us the original jobID on each row. Something like the below

 

IDappIDjobIDfromoriginal
1400900213617
1401213100617
1402100500617
1403500617617
1404617  
278176496528
278296528528
2783528 528

 

I was able to create this in DAX using multiple LOOKUPVALUE functions and IF statements, but I wanted to know if this could be done easier within Power Query. As the DAX calculated column is causing loading issues. I imagine I would need to create a loop in Power Query using an M language equivalent to LOOKUPVALUE.

 

Thanks!

2 REPLIES 2
slorin
Super User
Super User

Hi,

"the jobID which does not have a from value, meaning it is the original."

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vcy7EcAwCAPQXVRTGHD8mcXn/dcIOORCGhVPJ60FBqGWYjlPCis2vc4hBLb2cwkhXD/XEELjnryGEA76vA+vevNqtsTygB3JSKwhfrFv", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, appID = _t, jobID = _t, from = _t]),
No_From_Value = Table.SelectRows(Source, each [from] = "" or [from] = null),
Join = Table.NestedJoin(Source, {"ID"}, No_From_Value, {"ID"}, "No_From_Value", JoinKind.LeftOuter),
Original = Table.ExpandTableColumn(Join, "No_From_Value", {"jobID"}, {"original"})
in
Original

 

Stéphane

lbendlin
Super User
Super User

Not sure the Power Query version will be any faster. But in DAX you can use the PATH functions instead of LOOKUPVALUE.  Have you tried that?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.