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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
leebaldwin
Helper I
Helper I

DB2 validate/format date

Hello:

I have a large number of scripts that I am converting from a Viewpoint Sequel format that is using a DB2 connection and converting them to PowerBI. For the most part, I have been able to figure out the nuances between the DB2 code and the Power BI code. This is my first time working within PBI, but I am learning and driving to succeed in my new role.

 

I have come across a piece of code that I have tried everyway to figure out how to get PBI to do the same thing and I am not able to. 

 

CASE WHEN Valid_Date(o1odte ,'*MDY')=1 THEN CVTDATE(o1odte ,MDY) ELSE null END NAME(date1) COLHDG("DATE" "ORDERED") EDTCDE(4)

 

Is there a way to do this in Power BI during data import? 

2 REPLIES 2
Anonymous
Not applicable

Hi @leebaldwin ,

Please try to use database native queries when import data from DB2.

vbinbinyumsft_0-1670901371393.png

For more details, you can read related document: Import data from a database using native database query - Power Query | Microsoft Learn

You could also use "Switch()" DAX function in Power BI

For more details, you can read related document: SWITCH function (DAX) - DAX | Microsoft Learn

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Unfortunately, I have to use an ODBC connection to our DB2 server, so using native queries is not an option. 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.