Forum Discussion
Help needed- Distinct count with filter and multiple dates
- 3 years ago
Hello jgarcin8
i think you need Distinct count of [user_id] base on [acknowledgement_status] not [completion_date] and [distribution_date]. but you need in Count of [user_id] base on [completion_date] and [distribution_date].Please guide further.Distinct count based on completion_date =
CALCULATE (
DISTINCTCOUNT ( 'Distinct Count'[user_id] ),
'Distinct Count'[acknowledgement_status] = "Complete"
)
####################################################
count based on completion_date =
CALCULATE (
COUNT ( 'Distinct Count'[distribution_date] ),
ALLEXCEPT ( 'Distinct Count', 'Distinct Count'[completion_date] ),
'Distinct Count'[acknowledgement_status] = "Complete"
)
###################################################count based on distribution_date =
CALCULATE (
COUNT ( 'Distinct Count'[user_id] ),
'Distinct Count'[acknowledgement_status] = "All"
)jgarcin8 I hope this help you.
- Anonymous3 years ago
Hi jgarcin8 ,
I suggest you to add two columns to convert distribution date and completion date from datetime to date format.
distribution only date = DATEVALUE('Table'[distribution_date])completion only date = DATEVALUE('Table'[completion_date])Then create a calendar table.
Calendar = ADDCOLUMNS ( CALENDARAUTO (), "Year", YEAR ( [Date] ), "Quarter", "Q" & "" & QUARTER ( [Date] ), "Month", FORMAT ( [Date], "MMMM" ), "MonthSort", MONTH ( [Date] ) )Create two inactive relationship between tables.
Measure:
Measure1 = CALCULATE ( DISTINCTCOUNT ( 'Table'[user_id] ), USERELATIONSHIP ( 'Calendar'[Date], 'Table'[completion only date] ), 'Table'[acknowledgement_status] = "Complete" )Measure2 = CALCULATE ( COUNT ( 'Table'[user_id] ), USERELATIONSHIP ( 'Calendar'[Date], 'Table'[completion only date] ), 'Table'[acknowledgement_status] = "Complete" )Measure3 = CALCULATE ( DISTINCTCOUNT ( 'Table'[user_id] ), USERELATIONSHIP ( 'Calendar'[Date], 'Table'[distribution only date] ), USERELATIONSHIP ( 'Table'[distribution only date], 'Calendar'[Date] ), 'Table'[acknowledgement_status] = "All" )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Mahesh0016
It's close but what Im looking for is:
-How many unique users do we have per month (based on [completion date]) and filter by acknowledgement_status]="Complete".
-How many users do we have per month (based on [completion date]) and filter by acknowledgement_status]="Complete".
-How many unique users do we have per month (based on [distribution date]) and filter by acknowledgement_status]="All".
So I can graph the 3 metrics in this visual:
Do you have any suggestions? I really appreciate your help. Thank you
- Mahesh00163 years agoSuper User
jgarcin8 do you have month column base on [completion date] / [distribution date] in your table.
- jgarcin83 years agoFrequent Visitor
Hi Mahesh0016 - I don't have it. Every user can have a completion date and also a distribution date, but both dates are in separate columns.