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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Fetch data from same table different rows

Hello,

 

My problem is quite easy but I cannot find a solution. In Excel the green columns would do the the trick for the first part of the problem:

 

I have in Power Query (BI) the following as a table containing only the yellow columns. With Excel formulas I can quite easily fetch the helper columns (two custom columns + department type) and the result columns (team name, company name, area name). Results columns are the ones that I would like to have but I currently have only one column (row name) which contains department info that can be on different levels (team, company or area). In Excel 'custom columns' are fetched using index match from id & parent id columns. Department type fetched from 'row name' column (if row contains team, company or area). 

 

How can I do the same in query?

 

Capture.PNG

 

The formulas for the above:

 ID=K column, row name = L etc.

   FormulaFormulaFormulaFormulaFormulaFormula
idparent idrow namecustom column: parent nameCustom column: parent name 2Department typeTeam nameCompany nameArea name
12Team 1=INDEX(L:L;MATCH(K5;J:J;0))=INDEX(M:M;MATCH(M5;L:L;0))=IF(ISNUMBER(SEARCH("team";L5));"Team";IF(ISNUMBER(SEARCH("company";L5));"Company";"Area"))=IF(O5="Team";L5;"")=IF(O5="Team";M5;IF(O5="company";L5;""))=IF(O5="Team";N5;IF(O5="company";M5;L5))
23Company 1=INDEX(L:L;MATCH(K6;J:J;0))=INDEX(M:M;MATCH(M6;L:L;0))=IF(ISNUMBER(SEARCH("team";L6));"Team";IF(ISNUMBER(SEARCH("company";L6));"Company";"Area"))=IF(O6="Team";L6;"")=IF(O6="Team";M6;IF(O6="company";L6;""))=IF(O6="Team";N6;IF(O6="company";M6;L6))
34Area 1=INDEX(L:L;MATCH(K7;J:J;0))=INDEX(M:M;MATCH(M7;L:L;0))=IF(ISNUMBER(SEARCH("team";L7));"Team";IF(ISNUMBER(SEARCH("company";L7));"Company";"Area"))=IF(O7="Team";L7;"")=IF(O7="Team";M7;IF(O7="company";L7;""))=IF(O7="Team";N7;IF(O7="company";M7;L7))

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I solved this by myself using simply conditional columns and merge of columns. 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Any ideas? Can this be done with measures or new columns or should I do some kind of merging? Any help highly appreciated. I can also provide additional info if needed.

Anonymous
Not applicable

I solved this by myself using simply conditional columns and merge of columns. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.