The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
User | Count |
---|---|
86 | |
84 | |
35 | |
35 | |
34 |
User | Count |
---|---|
94 | |
79 | |
63 | |
55 | |
52 |