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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
TimothyJames
Frequent Visitor

Dynamically Merging Different Tables - Sub querying

Hello, we have a django web application that is utilizing content types and generic foreign keys, and if you're unfamiliar with that, essentially. Its a referential lookup on other tables. 

 

So in this example, I have merged together a few tables to represent this table structure, only showing relevant columns for complexities sake.

 

lookuptable (first row is formulas)

 

formulas being applied  merged in from django_contenttype using utilized_model_idmerged in from django_contenttype using utilized_model_idconcat("public ", app_label, "_", model)
idutilized_model_object_idutilized_model_idapp_labelmodellookuptable
14112aqeidareapublic aqe_idarea
25112aqeidareapublic aqe_idarea
36112aqeidareapublic aqe_idarea
47112aqeidareapublic aqe_idarea
58112aqeidareapublic aqe_idarea
36911354corelookuplookupcheckoutsectionpublic corelookup_lookupcheckoutsection

 

 

 

django_contenttype

idapp_labelmodel
1biqarea
2biqbuilding
112aqeidarea
354corelookuplookupcheckoutsection

 

 

aqe_idarea

idareanamearea rollup
4TM northtransmissions
5TM Southtransmissions
6TM north2transmissions
7tm south2transmissions
8TM south5transmissions

 

 

What I want to do is merge into the lookuptable the dynamic lookup from the related django_contenttypes with a subquery.

 

The resulting table would look like lookuptable, but it would have aqe_idarea.areaname and aqe_idarea.area rollup on rows 1 - 5, but then it would do the lookup for corelookup_lookupcheckoutsection.[column N's name] on row 3691.

 

 

How do I do this in the advanced query editor to essentially sub query for each row?

1 REPLY 1
AlexisOlson
Super User
Super User

I'm unsure that I'm understanding correctly. Can you explicitly show what the final result should look like for the given example?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.