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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
marianamarques
Advocate I
Advocate I

SQL statement issue

Hi all,
I'm trying to pull data to Power BI desktop using the following query:

SELECT * FROM SA_SHP_HST_HDR WHERE 'CUS_PRC_CLS' in ('xxx1',
'xxx2',
'xx3')

When I run the query it won't bring any results, the table is blank (with no errors). But if I pull the whole table, use the filter row function and apply the exactly same filters it will bring the results that I need. The thing is I have a list of codes that I would like to filter and to add them one by one to the filter function it's not the most efficient way.

I was wondering if something is wrong with my query or if the "WHERE" clause is not supported in the advanced options?

Appreciate your help!
Thanks
Mariana  

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@marianamarques, Did you try running in other environment and get any result? (excel, sql server management, etc..)

 

Try not to put '' in your column name.

 

Try this:

 

SELECT * FROM SA_SHP_HST_HDR WHERE CUS_PRC_CLS in ('xxx1',
'xxx2',
'xx3')

 

Or try this:

 

 

SELECT * FROM SA_SHP_HST_HDR WHERE CUS_PRC_CLS = 'xxx1' or CUS_PRC_CLS = 'xxx2' or CUS_PRC_CLS = 'xxx3'

 

I suppose that CUS_PRC_CLS is your column, and xxx1,xxx2,xxx3 are the values.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@marianamarques, Did you try running in other environment and get any result? (excel, sql server management, etc..)

 

Try not to put '' in your column name.

 

Try this:

 

SELECT * FROM SA_SHP_HST_HDR WHERE CUS_PRC_CLS in ('xxx1',
'xxx2',
'xx3')

 

Or try this:

 

 

SELECT * FROM SA_SHP_HST_HDR WHERE CUS_PRC_CLS = 'xxx1' or CUS_PRC_CLS = 'xxx2' or CUS_PRC_CLS = 'xxx3'

 

I suppose that CUS_PRC_CLS is your column, and xxx1,xxx2,xxx3 are the values.

 

@Anonymous Thank you! It worked without the ''!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors