Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
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_id | merged in from django_contenttype using utilized_model_id | concat("public ", app_label, "_", model) | ||
| id | utilized_model_object_id | utilized_model_id | app_label | model | lookuptable |
| 1 | 4 | 112 | aqe | idarea | public aqe_idarea |
| 2 | 5 | 112 | aqe | idarea | public aqe_idarea |
| 3 | 6 | 112 | aqe | idarea | public aqe_idarea |
| 4 | 7 | 112 | aqe | idarea | public aqe_idarea |
| 5 | 8 | 112 | aqe | idarea | public aqe_idarea |
| 3691 | 1 | 354 | corelookup | lookupcheckoutsection | public corelookup_lookupcheckoutsection |
django_contenttype
| id | app_label | model |
| 1 | biq | area |
| 2 | biq | building |
| 112 | aqe | idarea |
| 354 | corelookup | lookupcheckoutsection |
aqe_idarea
| id | areaname | area rollup |
| 4 | TM north | transmissions |
| 5 | TM South | transmissions |
| 6 | TM north2 | transmissions |
| 7 | tm south2 | transmissions |
| 8 | TM south5 | transmissions |
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?
I'm unsure that I'm understanding correctly. Can you explicitly show what the final result should look like for the given example?
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 12 | |
| 9 | |
| 8 | |
| 7 |