Forum Discussion

rmcgrath's avatar
rmcgrath
Advocate III
8 months ago
Solved

Need help with a line of M Code

Hello.  I need a line of M Code that will NOT filter the following [VOIDSTTS] of 0; [VOIDSTTS] of 1 where [VOIDDATE] > AsOfDate.

Right now, the AsOfDate is 9/6/2025.  Here are what the two columns look like and the third column is what result I am after:

[VOIDSTTS][VOIDDATE]KEEP OR FILTER OUT?
01/1/1900KEEP
01/1/1900KEEP
17/7/2025FILTER OUT
110/1/2025KEEP
01/1/1900KEEP
18/4/2024FILTER OUT
01/1/1900KEEP
01/1/1900KEEP
19/7/2025KEEP

 

  • If [VOIDSTTS] are of Text data type, and [VOIDDATE] are Date, you can do this by adding a step in M, 

     

    Table.SelectRows(#"laststep",
                    each

                   [VOIDSTTS] = "0" or ([VOIDSTTS] = "1" and [VOIDDATE] > #date(2025, 9, 6))
    )

     

     

2 Replies

  • If [VOIDSTTS] are of Text data type, and [VOIDDATE] are Date, you can do this by adding a step in M, 

     

    Table.SelectRows(#"laststep",
                    each

                   [VOIDSTTS] = "0" or ([VOIDSTTS] = "1" and [VOIDDATE] > #date(2025, 9, 6))
    )

     

     

  • rmcgrath Try the following:

    Table.SelectRows(#"Changed Type", each ([#"[VOIDSTTS]"] = 0 or [#"[VOIDDATE]"] > #date(2025, 9, 6) ))