Replicate DATE_TRUNC sql functionality

#1

Hi everyone,

Is there a way to easily replicate the DATE_TRUNC SQL function? Example
I have SQL background and I have been using that formula very regularly when it comes to group by dates.

For example, if I wanted to do the date_trunc up to the month on a date column from an excel, I would have to extract year, month and days, then multiply days * -1 and add 1, then do a date diff from the original date with those days. It feels a bit indirect, but I might be wrong. Any suggestions?

0 Likes

#2

Look at Time Series nodes description to pick what you need.
image

0 Likes

#3

Hi there @ijoel92,

not really. The closest to it (what might help) would be Extract Date&Time Fields node.

If I got you right, for your example it would mean to extract year and month using above mentioned node and then in GroupBy node group on year and month, while for aggregation use first on your date column (together with some sum I guess). Otherwise you can share some dummy data and expected output to see what is it about.

Br,
Ivan

0 Likes