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.
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.
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.
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.
Hope you are doing great.
We were wondering if our response helped you with your question.
Have you successfully created two columns by using
We would be glad to hear your feedback.