Hello Community. I'm using In-DB tools today, connecting to a server.
I have a standard SQL date field. I want to filter on the month and year only. I know that I can use the Filter tool and enter a BETWEEN date range, however, I need to enter each month range for an entire year.
"DEMAND_DATE" BETWEEN '2016-02-01'
AND
'2016-02-28'
I do not want to have to enter 12 filters for each month of each year and make sure that I have the correct number of days in each month. I get an error when trying to look for '2016-02-01' AND '2016-02-31' because the computer is smart enough to know that there are not 31 days in February :)
Also, I need to do this for 3 years in one workflow, that's 36 filters!
Am I missing a simple step to either do a fuzzy filter or something?
THANKS!
Solved! Go to Solution.
Hey @dsemitekol
Ok you're on the right lines.....to make this super simple rather than building loads of filters....Pull the Month and Year back in your query and then in the summarize tool...group by Month, Year, Customer ID/Customer Name and return the Min_Visit Date. This will give you the first instance of each month and year for each customer.
I've mocked up and example (not InDB but the principle is exactly the same).
Part time Tableau, Part Time Alteryx. Full Time Awesome
Thanks @LordNeilLord this is exactly what I was looking for. I can reduce the number of filters and then add a simple join at the end to pull the attributes for each customer back into the work flow.
Thanks again.
Here is the updated syntax for In-DB Formula Tool using SQL script and connecting to a Netezza server:
EXTRACT (month FROM "DATE")
Let month be the month value that you are looking to pull from the field
Let "DATE" be the title of the field that contains the dates