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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Mrafih
Frequent Visitor

Adding a new column to a table created with a formula

Hi there, Ive created the following table named 'Diff Table' in power BI using dax and want to add a 7th column called 'General name' to the table. The column I want to add exists exactly how I want to copy it over in another table i made called General name and is under a column called name. Ive included a picture of what I want it to look like.

Mrafih_0-1684249018844.png

(Diff table)

 

Mrafih_1-1684249225323.png

(General names)

 

This is a picture of what I want it to look like

powerbi test.png

 

I know I didnt explain it very well but any help is appreciated, thanks!

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

Hi @Mrafih ,

 

Calculated columns can only reference columns in their own tables. Below is the example.

vstephenmsft_0-1684376650991.png

But you can use the MAX, MIN, SELECTED functions to refer to other tables, but it will return values according to the definition of the function. Depending on your desired outcome, the value of your seventh column is matched against the Name column of the primary table.

vstephenmsft_1-1684377842141.png

vstephenmsft_2-1684377854826.png

The workaround is that your General names table can be created as follows. One column is the Name column of the unique primary table, and one column is the name column you want to match.

vstephenmsft_7-1684378457214.png

vstephenmsft_8-1684378472150.png

Then you can create a calculated column as follows.

Column = RELATED('General names'[name])

vstephenmsft_9-1684378525354.png

In summary, if you don't have a relationship to match rows, it's difficult.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

1 REPLY 1
v-stephen-msft
Community Support
Community Support

Hi @Mrafih ,

 

Calculated columns can only reference columns in their own tables. Below is the example.

vstephenmsft_0-1684376650991.png

But you can use the MAX, MIN, SELECTED functions to refer to other tables, but it will return values according to the definition of the function. Depending on your desired outcome, the value of your seventh column is matched against the Name column of the primary table.

vstephenmsft_1-1684377842141.png

vstephenmsft_2-1684377854826.png

The workaround is that your General names table can be created as follows. One column is the Name column of the unique primary table, and one column is the name column you want to match.

vstephenmsft_7-1684378457214.png

vstephenmsft_8-1684378472150.png

Then you can create a calculated column as follows.

Column = RELATED('General names'[name])

vstephenmsft_9-1684378525354.png

In summary, if you don't have a relationship to match rows, it's difficult.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

 

 

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors