Hello - I'm trying to filter my file based on two columns, Days to Next Purchase and Days since Prior Purchase. I want my results to include any transaction that has a number between -3 and 3 in the Days to Next Purchase column or the Days since Prior Purchase column. I've tried various combinations of using OR/AND in my statement but I still end up with results in the false output that should be true. Is there a way to do this with a filter?
[Days to Next Purchase]<=3 AND [Days to Next Purchase]>=-3
AND
[Days since Prior Purchase]<=3 AND [Days since Prior Purchase]>=-3
Here is an example of how I would expect them to be filtered.
Transaction # | Days to Next Purchase | Days since Prior Purchase | Filter Results |
1 | -5 | -5 | FALSE |
2 | -4 | -1 | TRUE |
3 | -3 | 21 | TRUE |
4 | -2 | 22 | TRUE |
5 | -1 | 0 | TRUE |
6 | 0 | 1 | TRUE |
7 | 1 | 5 | TRUE |
8 | 2 | 10 | TRUE |
9 | 3 | 45 | TRUE |
10 | 4 | 55 | FALSE |
11 | 5 | 3 | TRUE |
Using your logic and changing the AND to an OR statement in the Filter is working as you specify. Are there data points you are using that are not working?
[Days to Next Purchase]<=3 AND [Days to Next Purchase]>=-3
OR
[Days since Prior Purchase]<=3 AND [Days since Prior Purchase]>=-3
if abs([days to next purchase])<=3 and abs([days since prior purchase]) <=3 then "true" else "false" endif
@elclark
Maybe we should consider a dynamic way, in case your columns number or name would change.