Forum Discussion
Returning distinct values using a Measure
- Anonymous1 year ago
Hi MattTrollope ,
You can create a measure as below to get the number of distinct contacts, please find the details in the attachment.
Number of distinct Contacts = VAR _date = SELECTEDVALUE ( 'Date'[Date] ) RETURN CALCULATE ( DISTINCTCOUNT ( 'Role'[ContactID] ), FILTER ( 'Role', 'Role'[JoinDate] <= _date && 'Role'[CloseDate] >= _date ) )Best Regards
Thank you for your reply.
I have attached link to example pbix file demonstrating the problem. I'm trying to find the number of distinct Contacts with active Roles on a given date (not the number of roles each Contact has on the given date). The example shows the number of roles each contact has on the date. In the screenshot below I want to show 1 DistinctActiveRole for each Contact in the lower table.
Thanks for your assistance.
Hi MattTrollope ,
You can create a measure as below to get the number of distinct contacts, please find the details in the attachment.
Number of distinct Contacts =
VAR _date =
SELECTEDVALUE ( 'Date'[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Role'[ContactID] ),
FILTER ( 'Role', 'Role'[JoinDate] <= _date && 'Role'[CloseDate] >= _date )
)
Best Regards
- MattTrollope1 year agoFrequent Visitor
Thank you very much for your asistance. This now solves my problem, I wondered if a different approach might be the solution, and you have provided it for me, thank you again.