Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
How can I filter in Query that if the date values before year 2000 then replace to null value?
FYI, sometimes raw data has values with 1900-01-01 which is actually no value so I wanna filter them out as blank.
Solved! Go to Solution.
Hey there!
To filter out date values before the year 2000 and replace them with null values in Power Query (M Language), follow these steps:
Create a Custom Column
Replace the Old Column (Optional)
YourTable = Table.TransformColumns(
YourTable,
{{"YourDateColumn", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
Hope this helps!
😁😁
You need to change the first parameter to the name of the previous step, looks like should be "Source" in your case
Table.TransformColumns(
#"Source",
{{"준공예정일자", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
You need to specify each column but can be in the same operation
= Table.TransformColumns(
#"TOSS",
{{"준공예정일자", each if _ < #date(2000, 1, 1) then null else _, type nullable date},
{"Column1", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
Table.ReplaceValue(#"Table",each if Date.Year([Date Schedule Start]) < 2000 then [Date] else false ,null,Replacer.ReplaceValue,{"Date"})
Hey there!
To filter out date values before the year 2000 and replace them with null values in Power Query (M Language), follow these steps:
Create a Custom Column
Replace the Old Column (Optional)
YourTable = Table.TransformColumns(
YourTable,
{{"YourDateColumn", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
Hope this helps!
😁😁
Sorry not working
= Table.TransformColumns(
#"TOSS 데이터_공사목록 - Append",
{{"준공예정일자", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
You need to change the first parameter to the name of the previous step, looks like should be "Source" in your case
Table.TransformColumns(
#"Source",
{{"준공예정일자", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
thanks now is working,
can we apply this to all date columns? or shoud I name it column by column in the code?
You need to specify each column but can be in the same operation
= Table.TransformColumns(
#"TOSS",
{{"준공예정일자", each if _ < #date(2000, 1, 1) then null else _, type nullable date},
{"Column1", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
do you know reason I cannot filter in order?
= Table.TransformColumns(
#"Sorted Rows1",
{{"준공신고서제출일자", each if _ < #date(2000, 1, 1) then null else _, type nullable date}}
)
works for me
I think that code got error when initial value is null.
Can we create 2 conditions:
1. if value null then null.
2. if value before year 2000 then null.
if value doesn't meet above conditions then keep it as it is.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
26 |
User | Count |
---|---|
94 | |
50 | |
43 | |
40 | |
35 |