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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

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/

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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/

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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