Dynamic date filter

Solved!
emate
Level 5
Dynamic date filter

Hi All,

Is there a way to set up a dynamic filter, what I mean by that is, I am connecting my DB to DSS flow, and in my DB I have a data starting from 2014, is there a way to set up a filter that I won't need to update manually for getting only last 24 months from the max date I currently have in my DB?

 

Thanks,

 

1 Solution
AshleyW
Dataiker

Hi,

If Iโ€™ve understood what youโ€™re trying to do (I'm assuming you already have the data in DSS, among other things...), thereโ€™s a few ways you might accomplish this. One way would be to group the dataset to get the max_date, and then to join that resulting max_date back onto every row of the starting dataset. You can then 'filter using formula' in the filter recipe, or use a combination of processor/formulasโ€”diff() will be handyโ€”in the Prepare that will check if the date field you want to filter on is within 24 month of the max_date. When you re-build the datasets in the Flow, the filter will apply the date filter relative to the max_date you generated earlier.

LMK if that helps!

Cheers,
Ashley

View solution in original post

2 Replies
AshleyW
Dataiker

Hi,

If Iโ€™ve understood what youโ€™re trying to do (I'm assuming you already have the data in DSS, among other things...), thereโ€™s a few ways you might accomplish this. One way would be to group the dataset to get the max_date, and then to join that resulting max_date back onto every row of the starting dataset. You can then 'filter using formula' in the filter recipe, or use a combination of processor/formulasโ€”diff() will be handyโ€”in the Prepare that will check if the date field you want to filter on is within 24 month of the max_date. When you re-build the datasets in the Flow, the filter will apply the date filter relative to the max_date you generated earlier.

LMK if that helps!

Cheers,
Ashley

emate
Level 5
Author

Yes, thank you, you are totally right.