Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

How to get last 30 days information as a new column by using formula

Answered
Nafiul asked on September 23, 2020

Hello,
I need to make a column for the last 30 days by using formula. There has a date type column in the data set named as order_date. I want to show the last 30 days in one column and the rest of the date in a different column without changing the dataset.

Thanks
Nafiul

4 answers

Public
Milena Pechura Milena Pechura Flexmonster September 24, 2020

Hello, Nafiul,
 
Thank you for posting to our forum.
 
Our team is currently working on your question.
We will make sure to reach out to you shortly.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster September 25, 2020

Hello, Nafiul,
 
Thank you for your question.
 
We would like to suggest defining the 30 days ago date and then using its value in the if(condition,then,else) formula.
Please see the following code snippets for the reference:

 "formula": "if(max(\"order_date\") >" + timestampOfDay30DaysAgo + ", sum(\"price\"), 0)"

for the last 30 days.

"formula": "if(max(\"order_date\") >" + timestampOfDay30DaysAgo + ", 0, sum(\"price\"))"

for the rest of the dates.
 
We have also prepared an example for illustration: https://jsfiddle.net/flexmonster/tade1bhx/.
 
Please let us know if it works for you and if any further questions arise.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster October 7, 2020

Hello, Nafiul,
 
We are just checking in to ask if you’ve found our response helpful.
Could you please let us know if the provided formula works for your case?
 
Looking forward to your response.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster October 15, 2020

Hi, Nafiul,
 
Hope you are doing great.
 
We were wondering if our response helped you with your question.
Have you successfully created two columns by using formula?
 
We would be glad to hear your feedback.
 
Best regards,
Milena

Please login or Register to Submit Answer