Forum Discussion
Cumulative Total by Weeks
I am trying to create a measure to calculate cumulative registrations by weeks before an event takes place. I have a data set with 15 years of meeting registration data that includes the date a person registered and the date of the meeting. I created a calculated column to determine how many weeks before the meeting a person registered. I want to use this to compare how our event registrations from this year compare to previous years (i.e. so far in 2024 we are 24 weeks out from the meeting and have 111 registrations. In 2023 at 24 weeks out we had 101 registrations).
Calculated column for "Days Registered" = Table.AddColumn(#"Changed Type3", "Subtraction", each Duration.Days([Date Registered] - [Meeting Date]), Int64.Type)
Calculated column for "Weeks Registered" = Table.AddColumn(#"Inserted Date Subtraction", "Integer-Division", each Number.IntegerDivide([Subtraction], 7), Int64.Type)
I put the data into an Excel pivot table and this is what I want to recreate in PBI with the desired outcome being a chart similar to this:
| 2023 | 2024 | |||
| Weeks Registered | Total | Cumulative | Total | Cumulative |
| -42 | 1 | 1 | 0 | |
| -41 | 1 | 1 | 1 | |
| -40 | 1 | 1 | 2 | |
| -36 | 1 | 2 | 2 | |
| -34 | 7 | 9 | 2 | |
| -33 | 8 | 17 | 6 | 8 |
| -32 | 1 | 18 | 20 | 28 |
| -31 | 6 | 24 | 4 | 32 |
| -30 | 5 | 29 | 5 | 37 |
| -29 | 14 | 43 | 4 | 41 |
| -28 | 6 | 49 | 15 | 56 |
| -27 | 2 | 51 | 10 | 66 |
| -26 | 12 | 63 | 19 | 85 |
| -25 | 21 | 84 | 22 | 107 |
| -24 | 17 | 101 | 4 | 111 |
| -23 | 107 | 208 | 111 | |
| -22 | 102 | 310 | 111 | |
| -21 | 45 | 355 | 111 | |
| -20 | 153 | 508 | 111 | |
| -19 | 78 | 586 | 111 | |
| -18 | 39 | 625 | 111 | |
| -17 | 40 | 665 | 111 | |
| -16 | 40 | 705 | 111 | |
| -15 | 33 | 738 | 111 | |
| -14 | 47 | 785 | 111 | |
| -13 | 53 | 838 | 111 | |
| -12 | 88 | 926 | 111 | |
| -11 | 107 | 1033 | 111 | |
| -10 | 153 | 1186 | 111 | |
| -9 | 242 | 1428 | 111 | |
| -8 | 172 | 1600 | 111 | |
| -7 | 428 | 2028 | 111 | |
| -6 | 1177 | 3205 | 111 | |
| -5 | 248 | 3453 | 111 | |
| -4 | 228 | 3681 | 111 | |
| -3 | 160 | 3841 | 111 | |
| -2 | 87 | 3928 | 111 | |
| -1 | 181 | 4109 | 111 | |
| 0 | 225 | 4334 | 111 | |
| 1 | 1 | 4335 | 111 | |
| 2 | 1 | 4336 | 111 | |
| 3 | 3 | 4339 | 111 | |
| 4 | 1 | 4340 | 111 | |
| 6 | 1 | 4341 | 111 |
Here is a simplified example of the "Registrations" table:
| Meeting Name | Cancelled | Year | Meeting Date | Date Registered | Days Registered | Weeks Registered |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 5/27/2024 | -171 | -24 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 5/27/2024 | -171 | -24 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 5/23/2024 | -175 | -25 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 5/16/2024 | -182 | -26 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 5/9/2024 | -189 | -27 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 5/2/2024 | -196 | -28 |
| 2024 San Antonio | Yes | 2024 | 11/14/2024 | 4/21/2024 | -207 | -29 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 4/17/2024 | -211 | -30 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 4/11/2024 | -217 | -31 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 4/4/2024 | -224 | -32 |
| 2024 San Antonio | No | 2024 | 11/14/2024 | 3/26/2024 | -233 | -33 |
| 2024 San Antonio | Yes | 2024 | 11/14/2024 | 2/7/2024 | -281 | -40 |
| 2024 San Antonio | Yes | 2024 | 11/14/2024 | 1/31/2024 | -288 | -41 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 11/28/2023 | 27 | 3 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 11/20/2023 | 19 | 2 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 11/13/2023 | 12 | 1 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 11/1/2023 | 0 | 0 |
| 2023 St. Louis | Yes | 2023 | 11/1/2023 | 10/19/2023 | -13 | -1 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 10/4/2023 | -28 | -4 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 9/27/2023 | -35 | -5 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 9/20/2023 | -42 | -6 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 9/13/2023 | -49 | -7 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 8/23/2023 | -70 | -10 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 7/26/2023 | -98 | -14 |
| 2023 St. Louis | No | 2023 | 11/1/2023 | 5/10/2023 | -175 | -25 |
- Anonymous2 years ago
Hi bmjacques
For your question, here is the method I provided:
Here's some dummy data
"Table"
Create measures.
Total = CALCULATE( COUNTROWS('Table'), FILTER( ALL('Table'), 'Table'[Meeting Name] = MAX('Table'[Meeting Name]) && 'Table'[Weeks Registered] = MAX('Table'[Weeks Registered]) ) )Cumulative = SUMX( FILTER( ALL('Table'), 'Table'[Meeting Name] = MAX('Table'[Meeting Name]) && 'Table'[Days Registered] <= MAX('Table'[Days Registered]) ), 'Table'[Total] )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- AnonymousNot applicable
Hi bmjacques
For your question, here is the method I provided:
Here's some dummy data
"Table"
Create measures.
Total = CALCULATE( COUNTROWS('Table'), FILTER( ALL('Table'), 'Table'[Meeting Name] = MAX('Table'[Meeting Name]) && 'Table'[Weeks Registered] = MAX('Table'[Weeks Registered]) ) )Cumulative = SUMX( FILTER( ALL('Table'), 'Table'[Meeting Name] = MAX('Table'[Meeting Name]) && 'Table'[Days Registered] <= MAX('Table'[Days Registered]) ), 'Table'[Total] )Here is the result.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- bmjacquesFrequent Visitor
This is exactly what I needed, thank you so much!