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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
powerbi_ohio
New Member

PowerBI Import Issues

I have an existing query that I need to pull into PowerBI.  The query runs in dBeaver, SAS EG, Toad but when I paste the query into the SQL Statement under Advanced Options when I 'Get Data' it provides an error message.  The issue seems to be tied to a date time field.  
Here is the example of the From and Where clause:

from db.census
LEFT JOIN db.enroll on
census.id = enroll.id
and census.term = enroll.term
and enroll.date = '2024-01-29 00:00:37'dt
where (census.start_dt is null 
or census.leave_dt >= '2024-01-22 00:00:00'dt)
and census.include_flag = 'Y'

Any ideas on what I need to change the above date filters to so Desktop will import the data through the SQL statement?

 

1 ACCEPTED SOLUTION

Thanks for your help but I figured out a solution.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @powerbi_ohio ,

 

Based on the descriptive information you provided, the issue appears to be related to the date time field. In Power BI, you need to use a specific date format for the literal amount. Make sure your date literals are in a format like "YYYY-MM-DD HH:mm:ss" so that Power BI recognizes them.

vkongfanfmsft_0-1710224964774.png

 

Try to modify your formula like below:

FROM db.census
LEFT JOIN db.enroll ON
    census.id = enroll.id
    AND census.term = enroll.term
    AND enroll.date = '2024-01-29 00:00:37'

WHERE (census.start_dt IS NULL 
    OR census.leave_dt >= '2024-01-22 00:00:00')
    AND census.include_flag = 'Y'

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

I can't even get the raw data into PowerBI.  I'm using the SQL Statement dialogue box under advanced options.  The query that I have works in dBeaver, SAS and Toad, but when inserted into the SQL Statement dialogue box in PowerBI is when the error is triggered when trying to import.

lbendlin
Super User
Super User

What's the error message?

I had a typo in my query - I have included the updated query below that works in other applications but errors out on the import into PowerBI through the SQL statement box.  The error that is displayed is:

DataSource.Error: ODBC: ERROR [HY000] [Oracle][ODBC][Ora]ORA-01843: not a valid month

Details:
DataSourceKind=Odbc
DataSourcePath=dsn=~db~
OdbcErrors=[Table]

 

 

 

FROM db.census
LEFT JOIN db.enroll ON
census.id = enroll.id
AND census.term = enroll.term
AND enroll.date = '2024-01-29 00:00:37 AM'

WHERE (census.start_dt IS NULL
OR census.leave_dt >= '2024-01-22 00:00:00')
AND census.include_flag = 'Y'

Maybe take it a bit easy on the date formatting

 

FROM db.census
LEFT JOIN db.enroll ON
census.id = enroll.id
AND census.term = enroll.term
WHERE enroll.date = '2024-01-29'

AND (census.start_dt IS NULL OR census.leave_dt >= '2024-01-22')
AND census.include_flag = 'Y'

 

Note that 

 

WHERE enroll.date = '2024-01-29'

 

changes this to an inner join.

When I do that the error message changes to:

 

DataSource.Error: ODBC: ERROR [HY000] [Oracle][ODBC][Ora]ORA-01861: literal does not match format string

Are your date columns actual date columns or something else? 

Thanks for your help but I figured out a solution.

My belief is they are date/time - there is no data model for me to review and the only 'access' is through Access which I don't use.  In Access when you link to the underlying table - the column says it is Date/Time and the column in the table is stored as 1/29/2024 12:00:37 AM

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors