Forum Discussion
jppv20
3 years agoSolution Sage
Count records in previous time interval - Direct query mode
Hi,
My table visual looks like this (Where "Count id" is a count of the records in that time interval and "Count id -5" should be a measure):
What I need is the count of ids for the previous interval. Expected output for "Count id -5":
| Interval | Count id | Count id -5 |
| 4/23/2023 12:05:00 AM | 343 | 251 |
| 4/23/2023 12:10:00 AM | 291 | 343 |
| 4/23/2023 12:15:00 AM | 241 | 291 |
| 4/23/2023 12:20:00 AM | 241 | 241 |
| 4/23/2023 12:25:00 AM | 254 | 241 |
| 4/23/2023 12:30:00 AM | 239 | 254 |
Hope someone can help me out, thanks in advance!
Best,
Hi jppv20,
Can you try the following?
Count ID - 5 = CALCULATE( [Count Id], OFFSET( -1, , ORDERBY( Table[Interval], ASC ) ) )If I answered your question, please mark my post as a solution.
Best,