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
Will2020
Frequent Visitor

Relationship contains string (direct query)

hi guys

apologies if this has been posted before, I have found a lot of references to this for non-DirectQuery but not many for DirectQuery that I can make work or understand.

I have two large SQL views as the data sources. I am trying to set the relationship between the two views in PowerBI desktop (Jan2020 version).

On one table there are quotes, and on the other there are opportunities. On the opportunity view there is a quote number and a revision (two separate columns).

On the quote view this is one column with a hyphen (quotenumber-revision). 

Further example below:

Opportunity

Quote_numberRevision
2368923

 

Quote

Quote_number 
236892-3 

 

So I would like to get the relationship so that these two match, by dropping everything after the first hypen, or doing a "contains" somehow. The quote numbers are totally unique in the 'quotes' view, as this view only contains the newest quote revision. Therefore it still would maintain the one-to-many relationship.

It's direct query so I can't modify that data, the view is huge with millions of rows and it feeds from a production system. I just wonder if there is any way to do it in DAX or whether I could create another column which is not in the source DB.

thanks for the help in advance.

2 ACCEPTED SOLUTIONS
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Will2020,

 

have you tried to write a specific query to get the data from the Quote view? If you go to Power Query/Transform data, and on the Quote-table remove all steps but Source. Then doubble click on source, which will give you this popup:

 
 

Cheers,
Sturla

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Seems to work perfectly.

Thank you!

 

sturlaws
Resident Rockstar
Resident Rockstar

Hi @Will2020,

 

have you tried to write a specific query to get the data from the Quote view? If you go to Power Query/Transform data, and on the Quote-table remove all steps but Source. Then doubble click on source, which will give you this popup:

 
 

Cheers,
Sturla

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.