Forum Discussion
Cumulative calculation issue
-- Of course, 'Calendar' must be linked to -- Registered Date and Cancelled Date, one -- relationship being active (probably the -- one to with Registered Date). [Registered To Date] = var __lastVisibleDate = MAX ( Dates[Date] ) var __registeredToDate = CALCULATE( DISTINCTCOUNT( ShowMembers[UniqueID] ), 'Calendar'[Date] <= __lastVisibleDate, USERELATIONSHIP( 'Calendar'[Date], ShowMembers[Registered Date] ) ) return __registeredToDate [Cancelled To Date] =
var __lastVisibleDate = MAX ( Dates[Date] )
var __cancelledToDate =
CALCULATE(
DISTINCTCOUNT( ShowMembers[UniqueID] ),
'Calendar'[Date] <= __lastVisibleDate,
'Calendar'[Date] <> BLANK(),
USERELATIONSHIP(
'Calendar'[Date],
ShowMembers[Cancelled Date]
)
)
return
__cancelledToDate
Calendar must be marked as a Date table in the model.
Best
Darek
Hi Darek,
I have tested the calculation, we are getting closer :)
This is what the results show:
| Mar-19 | Apr-19 | May-19 | Jun-19 | |
| Cambridge | 120 | 126 | 128 | 129 |
| London | 127 | 127 | 124 | 120 |
| Oxford | 104 | 105 | 103 | 104 |
When comparing with the raw data it looks like for example for Jun 19, the members registered in June and the ones that have cancelled in June are missing.
The calculation shows a total of 353 members in June 19, where the raw data shows that we should have 363
I have noted that 4 members have registered in June and 6 have cancelled, which explains the 10 missing.
Any idea how the calculation could include those?
- Anonymous7 years agoNot applicable
Sorry but it's your responsibility to define what the meaning is of the numbers you want to calculate. I only implement the algorithm you give me. If the definition is not what you really meant, you have to change it and re-implement.
Sorry.
Best
Darek