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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
appsac1
Helper I
Helper I

having trouble with local model formula

i have a main table that is connected as a local model so i can't add any columns to it. for simplicity, lets say its a table of colors. column 1 is the color (blue, red, yellow), column 2 is a random value. i have a second reference table where i have those values and another attribute.

Table1

ColorValue

Blue

1
Blue2
Red1
Red2
Yellow1
Yellow2

 

Table2

1Light Blue
2Dark Blue
  

what i'm trying to do is pass thru that second table attribute if table1 is a certain color. so:

 

new color = if table1.color <> "blue" then table2.value2 else table1.color

ColorNew Color
BlueLight Blue
BlueDark Blue
RedRed
YellowYellow

 

normally i would go into power query, and merge table2 (reference table) with table1 (main table) then add my litle formula into a new column. but the main table is connected as a local model so i can't mess with that table. not sure how to get this done.

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @appsac1 ,

If you can't add columns in the main table, you can select Merge Queries>Merge Queries as New.

vkalyjmsft_1-1661418934140.png

Then add a custom column in the new merged table.

New Color = if [Color]="Blue" then [Table2.Sub_color] else[Color]

Then remove other unwanted columns and select remove duplicates of the whole table.

vkalyjmsft_2-1661419535863.png

Get the result.

vkalyjmsft_3-1661419615804.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @appsac1 ,

If you can't add columns in the main table, you can select Merge Queries>Merge Queries as New.

vkalyjmsft_1-1661418934140.png

Then add a custom column in the new merged table.

New Color = if [Color]="Blue" then [Table2.Sub_color] else[Color]

Then remove other unwanted columns and select remove duplicates of the whole table.

vkalyjmsft_2-1661419535863.png

Get the result.

vkalyjmsft_3-1661419615804.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

connected as a local model so i can't add any columns to it

That is not entirely accurate.  You can add calculated columns to the local model as long as they are entirely drived from the current row.

 

As for your question - not sure if TREATAS or LOOKUPVALUE are allowed in that scenario. Might be worth a try.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors