Hi team, Another date filter question - Is there a...
# gooddata-cloud
t
Hi team, Another date filter question - Is there a way to use the date filter on a segment of the date (i.e.. month or day of month rather than full date)? I am trying to create a report with upcoming employees' birthdays. The birthday value includes the year they were born, but I want the filter to be for birthdays either this month or within a relative time period (e.g., in the next 4 weeks).
j
Hi Tim, I’m afraid that nothing like that is possible out of the box. If you’re looking to filter for upcoming birthdays (e.g. in the next 30 days). The best possible solution I can think about it to prepare this data in your data source. For example add a new column in your data source — something like
days_until_birthday
, which would dynamically calculate how many days are left until someone’s birthday this year. Once you have a column like that, you can filter in a report like
days_until_birthday <= 30 AND >= 0
or similar.
t
Thanks for the response. Is there a way to build a value of their birthdate this year using date arithmetic? Would something like this be possible? THIS(DAY) - THIS(DAYOFYEAR) + DOB.MONTH + DOB.DAYOFMONTH?
m
Hi Tim, could you provide us an example?, by 'value' you mean an Integer? or something similar to JulianDay but with some fix/variable day zero?
t
I'm thinking of some way to use the date arithmetic values (date_diff, date_add) so that we could convert a value from a Date in a previous year to that month-day value but in the current year. My above formula was thinking maybe you could could get the start of the year using the THIS(DAY) (or some variant) function and then add X number of months and X number of days into that month? Just looking for a way to convert this data in GoodData itself as it should be a fairly simple transformation: E.g., January 10, 1982 -> January 10, 2025
j
Hi Tim, I’m sorry to be the bearer of bad news but for now, this approach wouldn’t work as such date arithmetic isn’t supported on GoodData Cloud product yet. If you wish, I will gladly submit a product feedback on your behalf. Otherwise, you would need to prepare this data on data source level as was mentioned.
t
Okay thanks! Yes, anything that can help to create fields like this in a dynamic way.
p
🎉 New note created.