Forum Discussion

petelanglois's avatar
petelanglois
Regular Visitor
4 years ago
Solved

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

  • 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] )
    

    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.

2 Replies

  • TheoC's avatar
    TheoC
    Community Champion

    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:

     

    All the best 

    Theo 🙂

  • v-zhangti's avatar
    v-zhangti
    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] )
    

    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.