Date frame having two categorical variable column with date time stamp.
| Date | Time | Va | Vb |
|---|---|---|---|
| 01-01-2023 | 05:55 | A | B |
| 01-01-2023 | 06:25 | A | |
| 01-01-2023 | 17:42 | B | |
| 01-01-2023 | 19:17 | A | B |
| 02-01-2023 | 05:55 | A | B |
| 02-01-2023 | 06:25 | A | B |
| 02-01-2023 | 17:42 | A | B |
| 02-01-2023 | 19:17 | A |
To group by the set by date and count Va and Vb for a date. Expected Result:
| Va | Vb | |
|---|---|---|
| 01-01-2023 | 3 | 3 |
| 02-01-2023 | 4 | 3 |
Wrote in previous slide
If you are using an SQL database (and those empty values are NULL):
DBFiddle demo