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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
joglidden2
Post Patron
Post Patron

Join not possible with direct query?

I have two sql server data sources that are direct query. I'm attempting to use naturalinnerjoin(), and I get the following message:

joglidden2_0-1604889582731.png

But this is not true! 

 

joglidden2_1-1604889645843.png

And, indeed, I'm attempting to naturalinnerjoin() on the 1 side of 1-to-many. This should work! 
Is it because PBI simply will not support joins on direct query data? 

Any help or suggestions would be appreciated. 

 

2 ACCEPTED SOLUTIONS
v-eqin-msft
Community Support
Community Support

Hi @joglidden2 ,

 

Try to use  RELATEDTABLE() function after building one-many relationship like this:

Measure 3 =
COUNTX ( RELATEDTABLE ( 'SEM' ), 'SEM'[Computer_Name] )

 11.12.3.1.PNG

 

Or change the storage mode from DirectQuery to Import.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

 

View solution in original post

joglidden2
Post Patron
Post Patron

@v-eqin-msft , your solution was adequate, and it works. But I'll tell you that I just simply gave up on direct query. Too troublesome. I've found that doing an import, then eliminating duplicates (to keep PBI from jack-knifing) is the most reliable solution. Then, I just do the "mashup" of data sources in a data gateway and schedule a refresh. I don't know if this is the best solution, but it's the most "working" solution. 

View solution in original post

10 REPLIES 10
joglidden2
Post Patron
Post Patron

@v-eqin-msft , your solution was adequate, and it works. But I'll tell you that I just simply gave up on direct query. Too troublesome. I've found that doing an import, then eliminating duplicates (to keep PBI from jack-knifing) is the most reliable solution. Then, I just do the "mashup" of data sources in a data gateway and schedule a refresh. I don't know if this is the best solution, but it's the most "working" solution. 

v-eqin-msft
Community Support
Community Support

Hi @joglidden2 ,


Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @joglidden2 ,

 

Try to use  RELATEDTABLE() function after building one-many relationship like this:

Measure 3 =
COUNTX ( RELATEDTABLE ( 'SEM' ), 'SEM'[Computer_Name] )

 11.12.3.1.PNG

 

Or change the storage mode from DirectQuery to Import.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

 

joglidden2
Post Patron
Post Patron

@v-eqin-msft , thanks for looking in to this for me. So basically, if the two data sources are from different databases, then joining is not possible, no matter the cardinality. This is good to know. 

 

I wonder if the only way to do this is through 'Direct Import'. 

 

v-eqin-msft
Community Support
Community Support

Hi @joglidden2 ,

 

In my test, NATURALINNERJOIN function works fine in DirectQuery mode as well when the two tables are from the same source table. 

 

11.11.1.1.PNG

But when there is no relationship between the two tables, or they are from different databases , the same error is reported. Please check.

11.11.1.2.gif

11.11.1.3.PNG

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

joglidden2
Post Patron
Post Patron

Like this should work, no?

joglidden2_0-1604955386360.png

joglidden2_1-1604955471032.png

 

 

amitchandak
Super User
Super User

@joglidden2 , you should filter for that .

calculate([measure], filter(Table2, Table2[col] = "ABC"))

 

Can you let us know exact need

joglidden2
Post Patron
Post Patron

Good question. Because I need to be able to create a ratio of two measures. One measure is filtered based on a column in the other table. I don't know how to create a ratio otherwise. 

amitchandak
Super User
Super User

@joglidden2 , Why you need natural join when the tables are already joined.  Column name should be same in case natural join

refer : https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/

joglidden2
Post Patron
Post Patron

And BTW, it fails on the many-side too: 

joglidden2_0-1604890326647.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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