I have a table:
PERSON_NUMBER ABS_DATE ABS_TYPE_NAME ABS_DAYS
-----------------------------------------------------------------------------
1010 01-01-2022 PTO 1
1010 01-01-2022 PTO 1
1010 06-01-2022 PTO 0.52
1020 02-02-2022 VACATION 1
1020 02-02-2022 VACATION 0.2
1030 01-12-2021 PTO 1
1030 01-12-2021 PTO 1
1040 02-12-2021 sick 1
1040 30-12-2021 sick 1
1050 30-01-2022 SICK 1
I want to add another column to the output, COUNT that tells me instances where for one person there are repetive data with same ABS_TYPE on same date.
PERSON_NUMBER ABS_DATE ABS_TYPE_NAME ABS_DAYS COUNT
------------------------------------------------------------------------------
1010 01-01-2022 PTO 1 2
1010 01-01-2022 PTO 1
1010 06-01-2022 PTO 0.52 1
1020 02-02-2022 VACATION 1 2
1020 02-02-2022 VACATION 1
1030 01-12-2021 PTO 1 2
1030 01-12-2021 PTO 1
1040 02-12-2021 sick 1 1
1040 30-12-2021 sick 1 1
1050 30-01-2022 SICK 1 1
I am using -
COUNT(ABS_DATE) OVER (PARTITION BY ABS_DATE, PERSON_NUMBER, ABS_TYPE_NAME
ORDER BY PERSON_NUMBER, ABS_TYPE_NAME)
But this is returning output 4 for the first row. Also it's returned for all rows. I want one value to come for these records.
Eg- if 2 came for 1st row, it should not come in 2nd