Forum Discussion
Cumulative calculation issue
Hi,
Thakns for your reply
The results should look like this:
| Numbers of Members per location | ||||||
| Jan-18 | Feb-18 | Mar-18 | Apr-18 | May-18 | … | |
| Cambridge | 123 | 120 | 126 | 128 | 129 | … |
| London | 122 | 127 | 127 | 124 | 120 | … |
| Oxford | 106 | 104 | 105 | 103 | 104 | … |
Cumulative new registered is counting all the members that have been registered so far.
Cumulative of cancelled will count all the members that have cancelled their membership.
Hope this helps.
Thanks.
Best
D.
- Anonymous7 years agoNot applicable
Hi Darlove,
Thanks for your patience,
so, as per you example, for a selected period of Jan-2018, the "cumulative new registered" is count UniqueID where "Registered Date" <=31-Jan-2018 (as it needs to also include all the new members that have registered in January)
And the "Cumulative of Cancelled" for the same period is the count of UniqueID where "Cancelled date" <= 31-Jan-2018
- Anonymous7 years agoNot applicable
-- 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
__cancelledToDateCalendar must be marked as a Date table in the model.
Best
Darek
- Anonymous7 years agoNot applicable
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
If the code I've given you is correct, please mark the post as THE answer.
Thanks.
Best
Darek