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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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

amitchandak
Super User
Super User

@Will2020 , Try combinevalues, This is column supported for direct Query

https://docs.microsoft.com/en-us/dax/combinevalues-function-dax

https://www.sqlbi.com/articles/using-combinevalues-to-optimize-directquery-performance/

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Will2020 , Try combinevalues, This is column supported for direct Query

https://docs.microsoft.com/en-us/dax/combinevalues-function-dax

https://www.sqlbi.com/articles/using-combinevalues-to-optimize-directquery-performance/

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.