Forum Discussion
Count distinct between two date with date slicer for line chart
- 8 years ago
Hi Quietlake,
Please check out the demo in the attachment.
1. Create a date table.
Calendar = ADDCOLUMNS ( CALENDARAUTO (), "MonthNum", MONTH ( [Date] ), "WeekNum", WEEKNUM ( [Date], 2 ) )2. DO NOT establish relationships.
3. Create a measure.
Measure = CALCULATE ( DISTINCTCOUNT ( count_distinct[user_id] ), FILTER ( 'count_distinct', 'count_distinct'[membership_period_start] <= MIN ( 'Calendar'[Date] ) && 'count_distinct'[membership_period_end] >= MIN ( 'Calendar'[Date] ) ) )Best Regards,
Dale
Hi Quietlake,
You said you want a line chart in your first post. Regarding to the question here, the solution could be like below. Because there isn't a start date of 2018/6/1. Please refer to the snapshot.
Measure 2 =
CALCULATE (
DISTINCTCOUNT ( count_distinct[user_id] ),
FILTER (
'count_distinct',
'count_distinct'[membership_period_start] >= MIN ( 'Calendar'[Date] )
&& 'count_distinct'[membership_period_end] <= MAX ( 'Calendar'[Date] )
)
)
Best Regards,
Dale
Hi Dale ( v-jiascu-msft ),
Thanks for the quick reply.
The daily line chart is definitely what I want in my original post and the measure_2 you show me by the picture is the right Month count.
Sorry for my poor description about the second question.
My second question is that is it possible to also draw two line charts like following graph ?
Or it is impossible based on my data source ( Right now I do not have the ability to figure out possible or not)
Best regards,
Quietlake