There is hourly data for 2 categories, and the value is the same for certain consecutive hours. To save space, the table is compressed as follows - Input Table: Category Datetime Value Count A 1/1/2024 0:00 5 1 A 1/1/2024 1:00 6 3 A 1/1/2024 4:00 4 1 A 1/1/2024 5:00 2 1 B 1/1/2024 0:00 1 2 B 1/1/2024 2:00 2 2 B 1/1/2024 4:00 4 1 B 1/1/2024 5:00 5 1 Desired Output: | Category | Datetime | Value | ------------ | ------------ | ------------ | A | 1/1/2024 0:00 | 5 | A | 1/1/2024 1:00 | 6 | A | 1/1/2024 2:00 | 6 | A | 1/1/2024 3:00 | 6 | A | 1/1/2024 4:00 | 4 | A | 1/1/2024 5:00 | 2 | B | 1/1/2024 0:00 | 1 | B | 1/1/2024 1:00 | 1 | B | 1/1/2024 2:00 | 2 | B | 1/1/2024 3:00 | 2 | B | 1/1/2024 4:00 | 4 | B | 1/1/2024 5:00 | 5 Continue reading...