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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Create a Calculated Column from Different Tables

I am using DirectQuery storage mode. I have a table where I want to create a new column using two columns already present in my table. However, those two columns come from different tables.

Using DIVIDE('table1'[col1], 'table2'[col2]) I am always thrown an error like "A single value for column 'col1' in table 'table1' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result." Each table has 8 rows and I filter so that I am really only trying to calculate a column of 4 rows. Specifying SUM returns the errors "Function 'SUM' is not allowed as part of calculated column DAX expressions on DirectQuery models."

I am guessing I need to create a distinct key for each table (say 1-8) and create a new relationship between the two tables I am using? I'm not sure what else to try.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@mwimberger  Thanks! I'm not actually creating a new table but I think creating a unique key in my query for each table and creating those relationships beforehand helped me merge the queries into one table so I could access the columns I wanted.

I found this article really helpful: https://community.powerbi.com/t5/Desktop/merge-queries/td-p/463371

View solution in original post

4 REPLIES 4
mwimberger
Resolver II
Resolver II

Hi @Anonymous 

 

You could try the RELATED function in your table - which will require a relationship between the two tables. DirectQuery will be the stumbling block here I suspect. DirectQuery may not be able to allow you to add columns .

 

Or if you need a result from the two columns instead consider using two measures 

[Measure1] = sum(table1[Col1])

[Measure2] =sum(table2[Col2])

 

[Measure3] = divide([Measure1],[Measure2])

 

Not sure if that helps any?

 

 

 

Phil Seamark posted a solution here that may help by creating a new table : 

 

https://community.powerbi.com/t5/Desktop/Direct-query-and-calculated-column-based-on-two-tables/m-p/130143/highlight/true#M55425

 

Hope that helps

 

Cheers

 

Manfred

Anonymous
Not applicable

@mwimberger  Thanks! I'm not actually creating a new table but I think creating a unique key in my query for each table and creating those relationships beforehand helped me merge the queries into one table so I could access the columns I wanted.

I found this article really helpful: https://community.powerbi.com/t5/Desktop/merge-queries/td-p/463371

I know it has been some time, but how did Merge solve the problem for you? You can't merge in Direct Query. I can only think you converted to Import Mode... something I cannot do in the project I am working on. 

Awesome, glad you had a win! 

 

Cheers

 

Manfred

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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