cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dgwilson Member
Member

QUERY ODBC data source - only import data WHERE condition is true

Good afternoon everyone.

I'm new to Power BI and have been making good progress.

 

I've got a challenge that I've been struggling with for hours to solve and searching for answers hasn't gone so well.

 

In the Advanced Editor I have the following:

 

-- BEGIN

let
Source = Odbc.DataSource("dsn=EDW_64", [HierarchicalNavigation=true]),
EDWP_D2PM_Schema = Source{[Name="EDWP_D2PM",Kind="Schema"]}[Data],
SD_ITSM_PROBLEMS_VW_View = EDWP_D2PM_Schema{[Name="SD_ITSM_PROBLEMS_VW",Kind="View"]}[Data]
in
SD_ITSM_PROBLEMS_VW_View

-- END

 

What I want to do is import data from the table SD_ITSM_PROBLEMS_VW where DELETE_FLAG = 'C'

 

I don't know if it can be done. And if it can I haven't been able to figure out how.

I've tried to replace [DATA] with [QUERY=....] and that gave syntax errors on the =.

 

This query will be used through a gateway and thus also reduce the amount of data coming through. The reduced data will also mean that I will not need to add filters to every visualisation!

 

- David

1 ACCEPTED SOLUTION

Accepted Solutions
v-ljerr-msft Super Contributor
Super Contributor

Re: QUERY ODBC data source - only import data WHERE condition is true

Hi @dgwilson,

 

If I understand you correctly, you should be able to use the SQL statement option to import the ODBC data in your scenario. Smiley Happy

SELECT * FROM SD_ITSM_PROBLEMS_VW WHERE DELETE_FLAG = 'C'

sql.PNG

 

Regards

View solution in original post

4 REPLIES 4
v-ljerr-msft Super Contributor
Super Contributor

Re: QUERY ODBC data source - only import data WHERE condition is true

Hi @dgwilson,

 

If I understand you correctly, you should be able to use the SQL statement option to import the ODBC data in your scenario. Smiley Happy

SELECT * FROM SD_ITSM_PROBLEMS_VW WHERE DELETE_FLAG = 'C'

sql.PNG

 

Regards

View solution in original post

dgwilson Member
Member

Re: QUERY ODBC data source - only import data WHERE condition is true

This gives me an error.

Though based on this I think I may need to specify some additional parameters (like database name) before the table. I will experiment. Syntax may be a bit of guess work.

Capture.PNG

dgwilson Member
Member

Re: QUERY ODBC data source - only import data WHERE condition is true

This seems to have solved it.

Note the <database name>.<table name> syntax.


Capture.PNG

 

Really appreciated your assistance and guidance. Thank you.

v-ljerr-msft Super Contributor
Super Contributor

Re: QUERY ODBC data source - only import data WHERE condition is true

Hi @dgwilson,

 

Great to hear the problem got resolved! Could you accept your reply above as solution to close this thread? Smiley Happy

 

Regards

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 337 members 3,264 guests
Please welcome our newest community members: