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
smpa01
Super User
Super User

Running SQL Queries on an excel table fails in PBI but works in excel

Hello Experts,

 

I am currently querying a large excel table in PQWRY and to avoid transformations using M, I thought of running SQL Statement on an excel table.

 

It is doable in excel. For example, I can query an excel data source in another excel by

Get Data-> From Other Queries-> From Microsoft Query->Excel Files.

excel query.PNG

 

I can utilize the Command text box to execute the SQL statement. It is

 

Now when I tried the same thing in Power BI, it did not work. I am not sure what am I doing wrong?

 

pqwry.PNG

xsxa.PNG

My raw data (table) is following

 

Count

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

 

I want to execute a SQL statement as

 

SELECT *
FROM table
WHERE [Count]<=10.
ORDER BY [Count] DESC

 

 

Any help is greatly apprecaited. I want to avoid slow and performance deterring M statements.

 

Thank you in advance.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
2 REPLIES 2
smpa01
Super User
Super User

I did another test where I queired a SQL server view and it worked fine both in excel and power bi

 

Excel

x1.PNG

 

This is what I am getting in PBI and these are my current ODBC drivers. I am not sure if the eroor is happeing due to the fact I don't have an odbc driver for excel. But I am also not sure if that is the case why it worked in excel in first place.

 

x2.PNG

 

Thanks

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@smpa01 

You might want to create a support ticket for further analysis of this issue.

 

Regards
Paul

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.