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
harizothman
Frequent Visitor

Lookup another data in different queries

Hi,

 

I hope everyone is doing great!

 

I really need help on this.

I have 2 sets of data from different files;

 

1. Training ID with finance status

Training IDFinance Status
A00001Invoices Pending
A00002Invoices Pending
A00003Invoices Complete
A00004Back Charged
A00005Back Charged

 

2. Training ID with learner details

Training IDFull NameUser ID
A00001Ainsley BrownAIBR
A00001Greg DavisGRDA
A00002Dennis PresleyDEPR
A00002Georgie CookGECO
A00003Eva RomeroEVRO
A00004Jessica GarlandJEGA
A00005Piers GreenwoodPIGR
A00005Joey BarberJOBA
A00005Sandra BarnettSABA

 

I would like to lookup the finance status from the 1st query into the 2nd query to be a new column as I want the trainings to match with the learner details. Something that looks like this;

 

Training IDFull NameFinance Status (new column)
A00001Ainsley BrownInvoices Pending
A00001Greg DavisInvoices Pending
A00002Dennis PresleyInvoices Pending
A00002Georgie CookInvoices Pending
A00003Eva RomeroInvoices Complete
A00004Jessica GarlandBack Charged
A00005Piers GreenwoodBack Charged
A00005Joey BarberBack Charged
A00005Sandra BarnettBack Charged

 

I want the data to be shown as a table and also as a filter to differentiate the learner details based on the finance status.

I tried the formula below but it took too long to load probably because my source of data is huge. 

Table.AddColumn(#"Renamed Columns", "Finance Status", each (let Session = [Training ID] in Table.SelectRows(#"First Query", each [Training ID] = Session)){0}[Finance Status])

 

Please help, thank you very much!

1 ACCEPTED SOLUTION
DataVitalizer
Super User
Super User

Hi @harizothman 

 

Add the the below lines right under you

#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Training ID"}, #"finance status", {"Training ID"}, "finance status", JoinKind.LeftOuter),
#"Expanded finance status" = Table.ExpandTableColumn(#"Merged Queries", "finance status", {"Finance Status"}, {"Finance Status.1"})
in
#"Expanded finance status"

Did it work ? Mark it as a solution to help spreading knowledge.

A kudos would be appreciated

 

View solution in original post

1 REPLY 1
DataVitalizer
Super User
Super User

Hi @harizothman 

 

Add the the below lines right under you

#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Training ID"}, #"finance status", {"Training ID"}, "finance status", JoinKind.LeftOuter),
#"Expanded finance status" = Table.ExpandTableColumn(#"Merged Queries", "finance status", {"Finance Status"}, {"Finance Status.1"})
in
#"Expanded finance status"

Did it work ? Mark it as a solution to help spreading knowledge.

A kudos would be appreciated

 

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.