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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ElliotG
Frequent Visitor

Replace (Blank) null values in DateTime Column with a String

Is it possible to replace null/(Blank) row values in a DateTime Column?  I have tried using a power query find and replace but it says it has to be replaced with a DateTime value.  I understand that makes sense so that PBI can categorize the data right but was wondering if there was a way around this.

For example, I have a stacked column chart where the X-axis is grouped by month.  I have a (Blank) bar due to null values in the column.

ElliotG_0-1708639938083.png

 


I'd like to do the following:

1. Replace the (Blank) with a string value "Working"

2. Move that bar to the most right bar in the graph

2 ACCEPTED SOLUTIONS
sayaliredij
Solution Sage
Solution Sage

Hi @ElliotG ,

 

I'm uncertain whether it's feasible in Power BI to implement the suggested approach. Since the column currently has only a datatype for datetime, changing it to text might be a workaround, but it raises concerns about losing the benefits of time intelligence and date hierarchy that are provided by a DateTime column.

 

Thanks and Regards,

Sayali

Please mark the question solved when done and consider giving a thumbs up if posts are helpful!! 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Anonymous
Not applicable

Hi @ElliotG

 

To replace null or blank values in a DateTime column, you need to use a DateTime value consistent with the column rather than a string such as "Working".

 

This is because Power BI requires consistent data types within columns.

 

You can consider converting the column data type to text type and replacing the value in power query.

 

Proceed as follows:

 

Here is the original dummy data.

 

vnuocmsft_1-1708670146961.png

 

vnuocmsft_0-1708670086651.png

Enter power query and modify the data type.

 

vnuocmsft_2-1708670372157.png

 

vnuocmsft_3-1708670388373.png

 

replacement value.

 

vnuocmsft_5-1708670571669.png

 

vnuocmsft_4-1708670517202.png

 

Close & Apply.

 

vnuocmsft_6-1708670661991.png

 

If you want to adjust the order of the column, you can modify it in the visual.

 

vnuocmsft_0-1708671646860.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

 

View solution in original post

4 REPLIES 4

you can use the M code directly in the Power Query Editor. Here's an example of how to replace null or blank values in a DateTime column named "MyDateTimeColumn" with a specific DateTime value.

 

Anonymous
Not applicable

Hi @ElliotG

 

To replace null or blank values in a DateTime column, you need to use a DateTime value consistent with the column rather than a string such as "Working".

 

This is because Power BI requires consistent data types within columns.

 

You can consider converting the column data type to text type and replacing the value in power query.

 

Proceed as follows:

 

Here is the original dummy data.

 

vnuocmsft_1-1708670146961.png

 

vnuocmsft_0-1708670086651.png

Enter power query and modify the data type.

 

vnuocmsft_2-1708670372157.png

 

vnuocmsft_3-1708670388373.png

 

replacement value.

 

vnuocmsft_5-1708670571669.png

 

vnuocmsft_4-1708670517202.png

 

Close & Apply.

 

vnuocmsft_6-1708670661991.png

 

If you want to adjust the order of the column, you can modify it in the visual.

 

vnuocmsft_0-1708671646860.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

 

 

That doesn't work as it removes the Date Hierarchy I need for the graph when it moves from Datetime to Text

sayaliredij
Solution Sage
Solution Sage

Hi @ElliotG ,

 

I'm uncertain whether it's feasible in Power BI to implement the suggested approach. Since the column currently has only a datatype for datetime, changing it to text might be a workaround, but it raises concerns about losing the benefits of time intelligence and date hierarchy that are provided by a DateTime column.

 

Thanks and Regards,

Sayali

Please mark the question solved when done and consider giving a thumbs up if posts are helpful!! 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.