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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Giel0
Frequent Visitor

Filter on date column with SQL ibm db2

Hi,

 

I have a large table which I would like to filter dynamically based on a date column. I have an orderdate column which has the format  YYYYMMDD from the IBM db2 database. 

However, if I would like to transform this column to a date, I get an error:

SQL query:

Giel0_4-1671008372919.png

I get a result in the Power Query editor:

Giel0_5-1671008435535.png

 

However, when I click on close & apply this error occurs:

Giel0_3-1671008353563.png

 

Does anyone has an idea on how to fix this? Tried a lot but nothing works..

My end goal is to compare the orderdate in the correct format with the date based on current timestamp: date(current timestamp). 

 

Thanks in advance!

 

 

 

 

 

 

 

 

3 REPLIES 3
Giel0
Frequent Visitor

Hi @alosada ,

 

Thanks for your response. Loading the whole table and make transformations in the Power Query editor works. However, the reason for the SQL query is because it is a large table while I only need a small part of it. So importing the whole table gives me a lot of data which I do not need and could potentially lead to performance problems. 

 

So to make the data load as efficient as possible I would like to query on the small part I of the data in the table I need.

 

Is there any way to use SQL to exclude the rows which cause this error?

alosada
Frequent Visitor

Hello @Giel0 ,

 

I don't think there's a way to use SQL to exclude the error rows, but here what I would do is filter the data that you need to keep with an SQL query and then trying to apply changes in PowerBI and see its behaviour.

alosada
Frequent Visitor

Hello,

 

by the error it seems that there is a value in the column that cannot be converted to Date and that's what giving you the error.

 

Why don't you try importing the table with the column as it comes and trying to transform it in DAX?

 

If you do so, and need help, i will be glad to help you!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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