Forum Discussion
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? |
| 0 | 1/1/1900 | KEEP |
| 0 | 1/1/1900 | KEEP |
| 1 | 7/7/2025 | FILTER OUT |
| 1 | 10/1/2025 | KEEP |
| 0 | 1/1/1900 | KEEP |
| 1 | 8/4/2024 | FILTER OUT |
| 0 | 1/1/1900 | KEEP |
| 0 | 1/1/1900 | KEEP |
| 1 | 9/7/2025 | KEEP |
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
- MasonMASuper User
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))
) - GeraldGEmerickSuper User
rmcgrath Try the following:
Table.SelectRows(#"Changed Type", each ([#"[VOIDSTTS]"] = 0 or [#"[VOIDDATE]"] > #date(2025, 9, 6) ))