Forum Discussion
Quietlake
8 years agoRegular Visitor
Count distinct between two date with date slicer for line chart
Hi, I'm new to Power BI & DAX. I had learned a lot from posts in this community. I encounter a problem and can not find a suitable way when I search the community. Sample Source Data Table (cal...
- 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
v-jiascu-msft
Microsoft Employee
8 years agoHi 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
Moliems
4 years agoFrequent Visitor
Hi there, this has been really helpful for a similar problem I am working with.
In addition to above, I would like to include members in the distinct count who have a blank membership end date (they are still members). Can you advise how the Dax above could to modified?
Thank you