Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Query Editor: IF Date < then empty

Hi,

 

I never work with Query Editor much, so I'm not sure how to do this.

I have a date field from a very old system, which doesn't know blank/null values. Meaning that if a date field is empty in the database its 01-01-1753.

 

I want to have every date before 1900 to be blank.  I tried something like below, but that doesn't seem to work.

= Table.AddColumn(#"Removed Other Columns", "Custom", each if [ARCHIEF_DATUM] <= Date.AddYears(DateTime.Date(DateTime.LocalNow()), -100) then 0 else [ARCHIEF_DATUM])

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I actually found a way because you made me think of it.

= Table.ReplaceValue(#"Replaced Value",#datetime(1753, 1, 1, 0, 0, 0),null,Replacer.ReplaceValue,{"ARCHIEF_DATUM"})

View solution in original post

4 REPLIES 4
Angith_Nair
Continued Contributor
Continued Contributor

Hi @Anonymous ,

Instead of making dates before 1900 blank , just filter the dates is after or equal to 01/01/1900 (assuming that dates before 1900 are not in use) in Power Query level. This will also decrease your refresh time.

Anonymous
Not applicable

I actually found a way because you made me think of it.

= Table.ReplaceValue(#"Replaced Value",#datetime(1753, 1, 1, 0, 0, 0),null,Replacer.ReplaceValue,{"ARCHIEF_DATUM"})

You can also refer to this  link.

Anonymous
Not applicable

Hi, @Angith_Nair, thanks for the input. But I can't do that. I need the data that it's connected to. The frontend software of the database does not show 1753 but shows the date as not filled. I want to replicate that in my table by making the date blank 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.