I am trying to get a negative value if the Follow-up date is in the future compared to today, and a positive value if the followup date is in the past compared to today. What is wrong with my formula?
ifelse(dateDiff({FollowUpDate}, now(), “DD”) < 0, dateDiff({FollowUpDate}, now(), “DD”), dateDiff({FollowUpDate}, now(), “DD”))
Hi @Imran_Chishti - If you really looking for the difference between future data and current date, why you will require if else condition. You can create a calculate field like - dateDiff({FollowUpDate}, now(), “DD”) and if it will give the desired result .
If possible, please provide sample input and desired output so that it will be easy to understand and advise you the right solution.
Regards - San
Hi @Sanjeeb2022 - Thank you so much for replying. The context is, I have a “Follow-up date” and I want to calculate the number of “days past due” - difference between today and the follow-up date. The catch is I want the days past due in the following format - for example, if follow-up-date was March 1, 2023, and today is March 31st 2023, it should give me the value, 30 days past due (this is the easy part). But if the follow-up-date is April 30 2023 and today is March 31st 2023, it should give me a negative number, -30 days past due. I hope this makes sense. Thanks.
Hi,
like San said, you dont need the ifelse function.

dateDiff already provides a negative value, if the first date ist bigger than the second date.
2 Likes
hi @thomask - Thank you for the details.
Hi @Imran_Chishti - Hope this is what you want.
Regards - San
2 Likes
HI Imran, As per my understanding I created the sample dataset & prepare the analysis.
Please have a look either it is working for you or not.
Step-1
I added a field as Follow Up Date manual field with data as past date & future Date.
Step-2
Create a calculated field as Now-Calc

Step- 3
Create a Date Difference between the two Date as Follow up Date and Now

Step -4
Then create a Table Visual and add all the dimension into that .

Note - Always use the dateDiff as Start Date and then End Date and so here Start Date is followup Date and End Date is Now()-Calc
Thanks & Regards
Biswajit Dash
2 Likes
Thank you so much, it works. Much appreciated.
1 Like
Than kyou so much - it works. Much appreciated. 
1 Like
Hey @Sanjeeb2022 @thomask @Biswajit_1993 Great team work to get this solved! Thanks so much! 
2 Likes
Hi @Imran_Chishti good to know you are finding your solutions please keep posting your query and solution on this platform.
2 Likes