Forum Discussion
Anonymous
2 years agoNot applicable
Problem counting from two databases based on various conditions
I have two databases one of supervisors and one of subordinates. I need to count the amount of times a supervisor and a subordinate have the same place, shift and Date.
What I have only considers if the conditions are true but doen't count them.
Table of Supervisors
SupDateShiftPlace
| Rachel | 11/12/2023 | 0000 | NY |
| Rachel | 11/13/2023 | 0000 | NY |
| Rachel | 11/14/2023 | 0000 | NY |
| Rachel | 11/15/2023 | 0000 | BT |
| Rachel | 11/16/2023 | 1600 | NY |
| Rachel | 11/17/2023 | 1600 | AT |
| Rachel | 11/18/2023 | 0800 | BT |
| Brown | 11/12/2023 | 0000 | AT |
| Brown | 11/13/2023 | 0000 | AT |
| Brown | 11/14/2023 | 0000 | AT |
| Brown | 11/15/2023 | 0800 | NY |
| Brown | 11/16/2023 | 0800 | BT |
| Brown | 11/17/2023 | 0800 | BT |
| Brown | 11/18/2023 | 0800 | NY |
Table of subordinates
SubDateShiftPlace
| Taylor | 11/12/2023 | 0000 | NY |
| Taylor | 11/13/2023 | 0000 | NY |
| Taylor | 11/14/2023 | 0000 | NY |
| Taylor | 11/15/2023 | 0000 | NY |
| Thomas | 11/16/2023 | 1600 | NY |
| Thomas | 11/17/2023 | 1600 | AT |
| Thomas | 11/18/2023 | 1600 | BT |
| Taylor | 11/12/2023 | 0000 | AT |
| Taylor | 11/13/2023 | 0000 | AT |
| Taylor | 11/14/2023 | 0000 | BT |
| Thomas | 11/15/2023 | 0800 | NY |
| Thomas | 11/16/2023 | 0800 | BT |
| Thomas | 11/17/2023 | 0800 | BT |
| Thomas | 11/18/2023 | 0800 | NY |
The correct answer would be
| Rachel | Brown | |
| Taylor | 3 | 2 |
| Thomas | 1 | 4 |
What I have until now is:
Same =
IF (
CONTAINS (
Sup,
Sup[Date], MAX(Sub[Date]),
Sup[Shift], MAX(Sub[Shift]),
Sup[Place], MAX(Sub[Place])
),
0,
1
)
Please help
I think there's a slight difference in the result.
2 Replies
- lbendlinSuper User
- Ashish_MathurSuper User