Forum Discussion
Cumulative Distinct Count by Date
- 7 years ago
Hi Anonymous,
here is one way to achive what you are looking for:
I assume that you already have a date table in your modell.
In your data table, you need to add a endDate column:
EndDate =
VAR endDate =
CALCULATE (
MIN ( [Date] );
FILTER (
Table;
Table[StartDate] > EARLIER ( Table[StartDate] )
&& Table[CustomerID] = EARLIER ( Table[CustomerID] )
)
)
RETURN
IF ( ISBLANK ( endDate ); DATE ( 9999; 12; 31 ); endDate )Then add this as a measure:
numberOfCustomerAboveScore =
VAR limit = 40
RETURN
CALCULATE (
DISTINCTCOUNT ( Table[CustomerID] );
FILTER (
ALL ( 'Table' );
MAX ( 'Date'[Date] ) >= Table[Date]
&& MAX ( 'Date'[Date] ) <= Table[EndDate]
&& Table[Score Running Total] >= limit
)
)You can use the limit value to decide your treshold.
best regards,
Sturla
sturlaws
Thanks so much for your help. Unfortunatel, I cannot make it work and I don't see what I did wrong. Could you please take a look?
Anonymous,
hm, I am not able to recreate that behaviour. Is there a relationship between the '03 - Score calculation' and the 'Calendar'-table?
Some other possible issues:
In the EndDate formula, I have made a typo CALCULATE( MIN([Date])... should be changed to CALCULATE( MIN('03 - Score calculation'[Date])..., but this should not be causing any issues.
In numberOfCustomersAboveScore the line
regards,
Sturla
EDIT: What data field did you put in the table? It should be the date from the Calendar-table, not the date from '03 - Score calculation'
- Anonymous7 years agoNot applicable
Thanks so much. It's a bit emberassing to tell: But the problem was the connection between the data and the calendar table. Works like a charm. Thank you!