Forum Discussion

FollowTheData's avatar
FollowTheData
Data Storage
12-08-2024

DDiff from a date field to current date/now

I used this formula to get days from creation to deactivation.

DDiff([Days in Client Last Deactivated On],[Days in Client Creation Date])

What formula can I use to obtain days from creation to current date/now?

I only have designer access to Sisense and do not have access to the data cube. 

 

 

 

 

2 Replies

  • HamzaJ's avatar
    HamzaJ
    Data Integration

    Hey FollowTheData ,

    You can use NOW() as a function in the formula. It does depend on your sisense version. Should work on Linux. I do think you will need to aggregate the formula max(ddiff())

    Hamza

  • I've used a similar formula in the past. We actually used a CASE formula to alternate between two scenarios: measuring between an 'open' and 'closed' date, and then if there is no 'closed' date, then measuring between the 'open' date and the current date. It was useful enough that I "starred" it for future reference in our system 🙂

    case 
    when [# of unique Days in Dispute Closed On]=0
    then min(DDIFF(Now([Days in Dispute Opened On]),[Days in Dispute Opened On]))
    else min(DDIFF([Days in Dispute Closed On],[Days in Dispute Opened On]))
    end

    Since it's only two conditions, you could probably do the same thing with a regular IF formula instead of CASE, but the CASE lets you add more conditions in the future if need be.