Hi @Sam,
I need to create a table dynamically and add a new column coming from a table in the model (I’m using a mixed-mode model)
I have a table in a SQL DB that lists regions and subregions. I cannot have this table changed.
So I was thinking to create a table for the tuples I’m interested with ALL(‘Dim SubRegion’[RegionName], ‘Dim SubRegion’[SubRegion]), then add the sort columns using a join.
Unfortunately, it didn’t work since the columns RegionName in the two tables have a different lineage.
I also tried with a table in the model using a SUMMARIZE then adding columns with LOOKUP. It worked but it’s not very elegant.
How can I create such a table in a smarter way?
Hi @BrianJ,
I’ve attached the excel with sample data and a power bi loading it.
I cannot make any ETL on the table on the DB, but I can have a local table to add a sort code to regions (users want to see regions in a specific order).
The Subregion table may change with no notice (subregions can be added/removed) while Regions are more stable, so I can maintain this local table without much effort.
I hope this is helpful. Full solution file attached below.
– Brian
PS - @sam.mckay typically leaves forum responses to the Expert Team, Power Users Group and members. Generally, you’ll get a better response if you just address your questions to All.
Hi @BrianJ,
it worked nicely.
I tried to use DATATABLE to create a temporary table but NATURALLEFTOUTERJOIN requires a base table. I think it makes sense since it is required in the model not only in the query.