Forum Discussion

CzarL's avatar
CzarL
New Member
3 years ago
Solved

Date Filter - Earliest date + 4 days

I am trying to filter a column with dates that are different everyday.

I want to have Earliest date + 4 days, is this possible?

  • Hi CzarL ,

    According to your description, here's my solution.

    Add a step like this:

     

    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] = Date.AddDays(List.Min(#"Changed Type"[Date]),4)))

     

    Here's the whole M syntax:

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtK31DdUitWBc4yQOcbIHBNkjikyxwyZY47MsVCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
        #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] = Date.AddDays(List.Min(#"Changed Type"[Date]),4)))
    in
        #"Filtered Rows"

     

    Get the correct result.

    To:

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

3 Replies

  • Hi CzarL ,

    According to your description, here's my solution.

    Add a step like this:

     

    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] = Date.AddDays(List.Min(#"Changed Type"[Date]),4)))

     

    Here's the whole M syntax:

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtK31DdUitWBc4yQOcbIHBNkjikyxwyZY47MsVCKjQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),
        #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Date] = Date.AddDays(List.Min(#"Changed Type"[Date]),4)))
    in
        #"Filtered Rows"

     

    Get the correct result.

    To:

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

    • CzarL's avatar
      CzarL
      New Member

      This worked perfectly!

       

      Thanks!