Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Max date in each row

I have following data

Start DateEnd Date
1-Jan-20 Null
 Null10-Jan-20
5-Jan-20 Null
 Null15-Jan-20
3-Jan-208-Jan-20

 

I want output be like-

1- Jan-20 10-Jan20

5-Jan-20  15-Jan-20

3-Jan-20   8-Jan-20

 

  • Anonymous 

    In Power Query,
    - Select both columns and Change Type to Date
    - Right-click on the End Date > Fill > Up

    - On the Start Date, Filter <> null


    You can paste below code in Blank Query and follow the steps

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtT1SszTNTJQ0lFS8CvNyVGK1YmGsnSUDA1gsiBRU7xKTZGVGiOUWsDFYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Start Date" = _t, #"End Date" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Date", type date}, {"End Date", type date}}),
        #"Filled Up" = Table.FillUp(#"Changed Type",{"End Date"}),
        #"Filtered Rows" = Table.SelectRows(#"Filled Up", each ([Start Date] <> null))
    in
        #"Filtered Rows"

     

     

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube, LinkedIn

     




    ______________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube, LinkedIn

1 Reply

  • Anonymous 

    In Power Query,
    - Select both columns and Change Type to Date
    - Right-click on the End Date > Fill > Up

    - On the Start Date, Filter <> null


    You can paste below code in Blank Query and follow the steps

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtT1SszTNTJQ0lFS8CvNyVGK1YmGsnSUDA1gsiBRU7xKTZGVGiOUWsDFYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Start Date" = _t, #"End Date" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Date", type date}, {"End Date", type date}}),
        #"Filled Up" = Table.FillUp(#"Changed Type",{"End Date"}),
        #"Filtered Rows" = Table.SelectRows(#"Filled Up", each ([Start Date] <> null))
    in
        #"Filtered Rows"

     

     

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube, LinkedIn

     




    ______________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube, LinkedIn