Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Responsive Resident
Responsive Resident

PBI and Postgresql, how to set blank date to TODAY()

We have a Postgresql database which Power BI can talk to. We have an Invoice table which has a posteddate field which is a data type of date. Sometimes this date is blank and the PBI ISBLANK() function does not work reliably with a blank date. I made a new column in the Invoice table:

Myposteddate = IF(ISBLANK(Invoice[posteddate])=TRUE,TODAY(),Invoice[posteddate)


When Invoice.posteddate was blank, sometimes today's date was inserted, sometimes it wasn't. So here's how I fixed it. I went to power query:

  1. For the posteddate column, I right clicked, chose Replace Values. 
  2. For "Value to find" I entered "null" (no quotes). For "Replace with" I entered "1/1/9999" (no quotes).
  3. Click out of Power Query and go back to the visual.
  4. Now I changed my custom column formula to: Myposteddate = IF(YEAR(Invoice[posteddate])=9999,TODAY(),Invoice[posteddate)
  5. If the posteddate is blank, it's changed to 1/1/9999 and I can later replace it with today's date. Remember that TODAY() is a date type, NOW() is a datetime type. We want a date. 

It works great and it works every time for all records! And year 9999 should never happen for quite a long time. 🙂

Super User
Super User

@croberts21 , Based on what I got


if the datatype is date or datetime in power bi then it should have null value in power query. if text it can have other values


replace null  with nay date and then change code manually  to



In the power query step


You can check for date of 1899/12/31 or 1900/01/01 also and replace it

"In the power query step You can check for date of 1899/12/31 or 1900/01/01 also and replace it"


That will work too.


Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors