Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

DAX: DATEDIFF for blank values

I have a column called "Last Activity", which shows the date of the last activity.

I created an additional column called "Days Since Last Activity" = datediff('Table'[Last Activity], today(), day)

 

However, "Last Activity" has many blank values (there has been no activity), which shows a blank value for days since last activity.

 

When there is a blank Last Activity value, I would like "days since last activity" to show the value 9999. 

So if Last Activity has a date, calculate the difference to today. If Last Activity does not have a date value, show 9999.

 

How can I update the column formula to achieve this?

  • Anonymous 

    pls try this

    = if(isblank('Table'[Last Activity]),9999,datediff('Table'[Last Activity], today(), day))

1 Reply

  • Anonymous 

    pls try this

    = if(isblank('Table'[Last Activity]),9999,datediff('Table'[Last Activity], today(), day))