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
DerMoe
Frequent Visitor

Extract ISO 8601 Date-Time and Convert it to Date-Time-Format

short explanation of the initial situation: I have a table in which answers come back. In addition, I receive the information about the data type of the answer. Furthermore I get the information until when the answer must be checked. The field "Until" is given in ISO 8601 date-time format. Power BI recognizes the ISO format and formats it correctly.

 

UntilDatatypeAnswers
2018-12-05T00:00:00.0000000+00:00STRINGThis one is a Test
2019-12-05T00:00:00.0000000+00:00INT500
2020-12-05T00:00:00.0000000+00:00DATETIME2018-12-05T00:00:00.0000000+00:00

 

Now I would like to extract the DATETIME from the answers and also format it, but unfortunately I get the following error message.

DerMoe_0-1646230921319.png

 

Does anyone here have a solution or have a similar problem?

 

1 ACCEPTED SOLUTION
vojtechsima
Memorable Member
Memorable Member

Hi, @DerMoe 
Here it's in Power Query:

vojtechsima_0-1646231480460.png

    #"Added Custom" = Table.AddColumn(#"Changed Type1", "TransformedAnswer", each if [Datatype] = "DATETIME" then [Answers] else null),
    #"Changed Type2" = Table.TransformColumnTypes(#"Added Custom",{{"TransformedAnswer", type datetime}})
in
    #"Changed Type2"

View solution in original post

3 REPLIES 3
vojtechsima
Memorable Member
Memorable Member

Hi, @DerMoe 
Here it's in Power Query:

vojtechsima_0-1646231480460.png

    #"Added Custom" = Table.AddColumn(#"Changed Type1", "TransformedAnswer", each if [Datatype] = "DATETIME" then [Answers] else null),
    #"Changed Type2" = Table.TransformColumnTypes(#"Added Custom",{{"TransformedAnswer", type datetime}})
in
    #"Changed Type2"

WOW! Thank you for that realy quick answer! You helped me a lot

@DerMoe 
Happy to help, 
if you could please Kudo my answer to help me out, I would appreciate that. 
Thank you

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.