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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
vicky2123131
Frequent Visitor

Cannot convert value '6/4/' of type Text to type Integer.

Hi,

I'm getting this error " Cannot convert value '6/4/' of type Text to type Integer. " 

below screen shot id the sample "created date" column data

vicky2123131_0-1683181726666.png

Below is the calculated column used:

 

In Created Date = Date(Left(LOOKUPVALUE('Dim_In'[CreatedDate],
Dim_In[Id],
Vw_GC_In_Benefit_Pvt_Data_SnapShot[In ID]),4),Mid(LOOKUPVALUE('Dim_In'[CreatedDate],
Dim_In[Id],
Vw_GC_In_Benefit_Pvt_Data_SnapShot[In ID]),6,2),Mid(LOOKUPVALUE('Dim_In'[CreatedDate],
Dim_In[Id],
Vw_GC_In_Benefit_Pvt_Data_SnapShot[In ID]),9,2))
3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @vicky2123131 ,

 

Please try:

In Created Date =
VAR _date =
    LOOKUPVALUE (
        'Dim_In'[CreatedDate],
        Dim_In[Id], Vw_GC_In_Benefit_Pvt_Data_SnapShot[In ID]
    )
VAR _month =
    LEFT ( _date, FIND ( "/", _date, 1 ) - 1 )
VAR _day =
    MID (
        [Column1],
        FIND ( "/", _date, 1 ) + 1,
        FIND ( "/", _date, FIND ( "/", _date, 1 ) + 1 )
            - FIND ( "/", _date, 1 ) - 1
    )
VAR _year =
    RIGHT ( _date, 4 )
RETURN
    DATE ( _year, _month, _day )

Or 

In Created Date2 =
VAR _date =
    LOOKUPVALUE (
        'Dim_In'[CreatedDate],
        Dim_In[Id], Vw_GC_In_Benefit_Pvt_Data_SnapShot[In ID]
    )
RETURN
    DATE ( YEAR ( _date ), MONTH ( _date ), DAY ( _date ) )

Final output:

vjianbolimsft_0-1685089452308.png

 

Best Regards,

Jianbo Li

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

Ahmedx
Super User
Super User

Share sample pbix file to help you.

lbendlin
Super User
Super User

looks like the year is missing from your data, and Power Query is guessing that you mean the current year.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.