Forum Discussion

krzysztof's avatar
krzysztof
Helper III
6 years ago
Solved

Problem with changing the type of date needed for incremental refresh

I’m asking for your help. I know that I can do incremental refresh in premium version but I came to the point that first I need to convert the date format „YYYMMDD” into power query on datetime with function (x as datetime) => Date.Year(x)*10000 + Date.Month(x)*100 + Date.Day(x).

 

Unfortunately I can't handle it.  Please help me how to do it. I attach an pbx file with a sample of csv data.

Sample pbx & data csv: https://drive.google.com/open?id=1axHPdzkikQ-NvmFhcnTmm9_dTKSjQZb8 

 

  • Hi there, if you have your original date in number format, you can create this "getdatetime" function:

     

    (datecolumn as number) =>
    let
    Source = DateTime.FromText(Text.From(datecolumn) & "T000000")
    in
    Source

     

    Then you can add a custom column:

     

    getdatetime([DimDate_ID])

     

    And you will get your datetime value.

     

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

     

    Regards,

     

    Gian Carlo Poggi

1 Reply

  • gpoggi's avatar
    gpoggi
    Responsive Resident

    Hi there, if you have your original date in number format, you can create this "getdatetime" function:

     

    (datecolumn as number) =>
    let
    Source = DateTime.FromText(Text.From(datecolumn) & "T000000")
    in
    Source

     

    Then you can add a custom column:

     

    getdatetime([DimDate_ID])

     

    And you will get your datetime value.

     

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

     

    Regards,

     

    Gian Carlo Poggi