Hi,
I have the following dataset:
Week | Hours |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_02 | 32 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
2023_01_09 | 40 |
Expected output:
Week | Hours |
2023_01_02 | 32 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_02 | 0 |
2023_01_09 | 40 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
2023_01_09 | 0 |
Is there anyway to do this logic without hard coding it?
Solved! Go to Solution.
Hi @wonka1234
You could use a multi-row formula to check for this. This formula is checking to see if the week is different than the preceding row. If it is, it keeps the value, otherwise it sets to 0