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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
petelanglois
Regular Visitor

How to remove a specific date from a date column

Hello,

 

I have a calculated date column with date+time values. I changed the data type to short date so the time component is no longer there.

 

I would like to create a new column that contains the same values as the original column, but with all records that have the value 05/29/2021 to be replaced with blanks. I’m having trouble figuring out how to do this.

 

Currently, I’m using the following dax:

 

new date column = IF(DimLeads[Date] = date(2021,05,29), BLANK(), DimLeads[Date])

 

The current result is a new column that contains the date+time values, including for 5/29/2021, even though I changed the data time in the original column to be short date.

 

Can anyone explain how to write dax to do this?

 

Thank you!
Pete

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @petelanglois 

 

I tried to use your if function to achieve the result you want.

Column = 
IF ( DimLeads[Date] = DATE ( 2021, 05, 29 ), BLANK (), DimLeads[Date] )

vzhangti_0-1636007993241.png

Is the expected result you want like this? If not, please reply with more details. Thank you.

 

Best Regards,

Charlotte Zhang

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @petelanglois 

 

I tried to use your if function to achieve the result you want.

Column = 
IF ( DimLeads[Date] = DATE ( 2021, 05, 29 ), BLANK (), DimLeads[Date] )

vzhangti_0-1636007993241.png

Is the expected result you want like this? If not, please reply with more details. Thank you.

 

Best Regards,

Charlotte Zhang

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

TheoC
Super User
Super User

Hi @petelanglois 

 

Apologies mate, had to adjust previous. This is what you're after 🙂

 

Column =

VAR _DateBlank = DATE ( 2021 , 5 , 29 )
VAR _DateColumn = 'Calendar'[Date]

RETURN

IF ( _DateBlank = _DateColumn , BLANK() , _DateColumn )
Please adjust the table to relevant table and column name.  Outputs below:
TheoC_1-1635831015119.png

 

All the best 

Theo 🙂

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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