You can translate the question and the replies:

first of current year

how do I pull first of current year and forward? for example, when the date is currently 1/1/24 to 12/31/24, I always want to get results from 1/1/2024 and forward.
user
12-04-2024 13:41:24 -0400
code

1 Answer

Hi, I would try making a derived view over the view you would like to only get results for the current year. If you make a new selection view with a date comparison in the where clause, that should do the trick. Imagine you have a data source called ds_web_orders and the following base view called bv_wo_orders | id | customer_code | status | date_placed | data_delivered | date_closed | -------- | -------- | -------- | -------- | -------- | -------- | | 1 | Dm5SMlTXa | Closed | 9/29/2015 11:20 | 10/3/2015 3:20 | NULL | 2 | qRQH2gfl8bKV | Canceled | 5/10/2015 13:24 | 5/13/2015 4:24 | 5/16/2015 4:24 | 3 | BDuF6LOCdm0I | Delivered | 11/2/2024 12:57 | NULL | NULL | 4 | LzgXAIWNmfA | Pending | 4/21/2024 23:23 | NULL | NULL | 5 | 7oQVKW | Accepted | 3/24/2024 18:49 | NULL | NULL | 6 | rAxDT8B | Pending | 12/27/2024 23:26 | NULL | NULL | 7 | 3OznHHIcf | Accepted | 8/29/2024 0:48 | NULL | NULL | 8 | 77LeGK2P | Closed | 11/18/2015 6:51 | NULL | 11/24/2015 21:51 | 9 | 4RsjJT | Delivered | 2/22/2015 8:15 | NULL | NULL | 10 | R2wx3e6 | Pending | 10/16/2015 9:28 | NULL | NULL If you create a derived view (selection view) called dv_orders_current_year over bv_wo_orders, You can set the where condition to be: `GETYEAR(bv_wo_orders.date_placed) = GETYEAR(NOW())` The results from dv_orders_current_year will be | id | customer_code | status | date_placed | data_delivered | date_closed | -------- | -------- | -------- | -------- | -------- | -------- | | 3 | BDuF6LOCdm0I | Delivered | 11/2/2024 12:57 | NULL | NULL | 4 | LzgXAIWNmfA | Pending | 4/21/2024 23:23 | NULL | NULL | 5 | 7oQVKW | Accepted | 3/24/2024 18:49 | NULL | NULL | 6 | rAxDT8B | Pending | 12/27/2024 23:26 | NULL | NULL | 7 | 3OznHHIcf | Accepted | 8/29/2024 0:48 | NULL | NULL On the next upcoming New Year's Day, dv_orders_current_year won't return any results until additional rows are added to ds_web_orders with the date_placed containing the year 2025. Hope this helps!
Denodo Team
12-04-2024 16:37:28 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here