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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Cannot convert value '44253' of type Text to type Date.

Hi Experts,

 

I am getting an error while converting data type from "Text" to "Date/time".  Please find the below data for reference.

 

Go-live/End-date
16-02-2021
14-02-2021
44527
44265
Not Applicable 
Not Applicable 
Not Applicable 
Not Applicable 
Not Applicable 
Not Applicable 
44264

 

I have a Date column in my table and the data type is "Text". Now i want to convert integer values "44527" to "Date" Data type in Power BI and need to show these "44527" value as "Date" in my report. I tried to change the type Text to Date but got another error for "Not Applicable", but i also need to show "Not Applicable" as well.

Could anyone help on this issue?

 

Best Regards,

Srihari

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Sorry for my misunderstanding, please try this:

Measure =
VAR _int =
    IFERROR (
        CONVERT ( MAX ( 'Table'[Go-live/End-date] ), INTEGER ),
        MAX ( 'Table'[Go-live/End-date] )
    )
RETURN
    IFERROR ( CONVERT ( _int, DATETIME ), MAX ( 'Table'[Go-live/End-date] ) )

convert int to date.PNG

Here is the pbix file.

 

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Sorry for my misunderstanding, please try this:

Measure =
VAR _int =
    IFERROR (
        CONVERT ( MAX ( 'Table'[Go-live/End-date] ), INTEGER ),
        MAX ( 'Table'[Go-live/End-date] )
    )
RETURN
    IFERROR ( CONVERT ( _int, DATETIME ), MAX ( 'Table'[Go-live/End-date] ) )

convert int to date.PNG

Here is the pbix file.

 

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

Anonymous
Not applicable

Hi @Anonymous ,

 

Please try the following formula to create a measure:

Measure =
IF (
    CONTAINSSTRING ( MAX ( 'Table'[Go-live/End-date] ), "-" ),
    CONVERT ( MAX ( 'Table'[Go-live/End-date] ), DATETIME ),
    "Not Applicable"
)

The final output is shown below:

2.18.3.1.PNG

 

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

 

Anonymous
Not applicable


Hi @Anonymous

Thanks for the quick response. But in my scenario I have to convert integer values (44265,44527 ) as Date data type because in my data source file (SharepPoint)"Go-live/End-date" column contains date data type only but while importing data from source to Power BI then Power BI engine reading these date values as text data type and it is aggregating the values in Go-live/End-date column.
I want to show final output like below one.

Output.PNG
Please Note, I laso need to show "Not Applicable" as one of the value for respective rows. So, whenever I tried to convert from Text to Date type in power query I am getting an error for "Not Applicable" as well.
So I want to achevive it using DAX. Could you please provide me the required output?

 

Best Regards,
Srihari

amitchandak
Super User
Super User

@Anonymous , You have to check the format in power query or check for all number and then add these days to 01-01-1900 and check

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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