Hey guys, I have two tables one is the fact table and another is a criteria table. I want the criteria table to filter the fact table.
Fact Table
ID | Region | Line | YearMonth | Hours |
1 | Asia | Core | 2023-12 | >500 |
2 | Asia | Core | 2022-01 | > 500 but < 1000 |
3 | Americas | Core | 2022-05 | > 500 but < 1000 |
4 | Oceania | Not Core | 2021-12 | > 1000 but < 2500 |
5 | Asia | Not Core | 2023-06 | > 5000 but < 10000 |
6 | Americas | Core | 2022-12 | >6000 but < 7000 |
7 | Americas | Core | 2022-02 | <500 |
Criteria Table which will filter the fact table including the range of month and hours.
Region | Line | YearMonth | Hours |
Asia | Core | After 2021-12 | >500 |
Americas | Core | After 2021-12 | >5000 |
Output will be
ID | Region | Line | YearMonth | Hours |
1 | Asia | Core | 2023-12 | >500 |
2 | Asia | Core | 2022-01 | > 500 but < 1000 |
3 | Americas | Core | 2022-05 | > 500 but < 1000 |
6 | Americas | Core | 2022-12 | >6000 but < 7000 |
you notice that ID 7 is not part of the output because it has <500 hours while the criteria has >500 hours for Americas Core
the Criteria table is from a SQL table and will change every time but the fields are static and will run on a schedule.
Though your real data would be much more complicated, I prepared WF so as to fit to your provided sample data.
By the way, ID=3 is NOT match, isn't it? ID=3 is having hours between 500 and 1000 while criteria says > 5000 so it doesn't meet criteria.