Forum Discussion
bricohen1
6 years agoFrequent Visitor
Count Distinct Dates Between Start Date and End Date Columns
Suppose I have this:
| Member | Start | End |
| member1 | 1/1/2019 | 1/5/2019 |
| member1 | 1/1/2019 | 1/5/2019 |
| member1 | 1/1/2019 | 1/6/2019 |
| member2 | 3/1/2019 | 3/2/2019 |
| member2 | 3/1/2019 | 3/3/2019 |
This table reflects six distinct dates for member1: 1/1/19, 1/2/19, 1/3/19, 1/4/19, 1/5/19, and 1/6/19.
..and three distinct dates for member2: 3/1/19, 3/2/19, 3/3/19
Is it possible to create a Measure to compute something like this?
The measure would compute the number of distinct dates per member, based on the Start and End date.
I've been working on this for hours - any ideas would be appreciated.
Thanks!
Brian
try to create a table
Table Calendar = ADDCOLUMNS( crossjoin(calendar(min('Table'[Start]);max('Table'[End]));distinct('Table'[Member])); "is in day";if(calculate(count('Table'[Member]);filter('Table'; 'Table'[Start]<=[Date] && 'Table'[End] >= [Date] && EARLIER('Table'[Member])=[Member]))>0;1;0) )then just summarize it:
Table Total = summarize('Table Calendar';'Table Calendar'[Member];"Count";SUM('Table Calendar'[is in day]))do not hesitate to give a kudo to useful posts and mark solutions as solution
6 Replies
- az38
Community Champion
Hi bricohen1
what exactly result do you expect?
anyway try a measure
Measure = DATEDIFF(CALCULATE(MIN('Table'[Start]);ALLEXCEPT('Table';'Table'[Member]));CALCULATE(MAX('Table'[END]);ALLEXCEPT('Table';'Table'[Member]));DAY)do not hesitate to give a kudo to useful posts and mark solutions as solution