cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DevDelwyn Frequent Visitor
Frequent Visitor

distinctcount filter different days

Hi, I am new to DAX and struggling to find a working solution.

 

On a Table 'Call Log' I have an [Customer No] colIumn and [Contact Date] whixh shows all calls received.

 

I am trying to show how many time customers contacted (count of entries in table for Customer No) but only counting 1 instance for each Date. (ie if Customer X contacted twice on Monday and once on Tuesday result should show "2".

 

My latest incorrect result is below but having read through a number of queries on similar topics using GroupBy or SUMMARIZE nothing I have found is producing the correct results

Repeat Contact Count = CALCULATE(DISTINCTCOUNT('Call Log'[Customer No.]),SUMMARIZE('Call Log'[Customer No.],'Call Log'[Contact Date]))

Any help or guidance would be grately received.

 

Example Data

Customer NoContact Date
AA0101/01/2019
AA0201/01/2019
AA0101/01/2019
AA0301/01/2019
AA0102/01/2019
AA0202/01/2019
AA0103/01/2019

 

 

Expected Result

Customer NoCount of Contact
AA013
AA022
AA031
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: distinctcount filter different days

Hi @DevDelwyn ,

Please try the measure below.

Measure =
VAR t =
    SUMMARIZE ( 'Table1', 'Table1'[Customer No], 'Table1'[Contact Date] )
RETURN
    CALCULATE ( COUNTROWS ( t ), ALLEXCEPT ( Table1, Table1[Customer No] ) )

Here is the output.

Capture.PNG

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: distinctcount filter different days

Sample data would be really helpful. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

DevDelwyn Frequent Visitor
Frequent Visitor

Re: distinctcount filter different days

Hi Greg, I have added a short data example above.

 

Community Support Team
Community Support Team

Re: distinctcount filter different days

Hi @DevDelwyn ,

Please try the measure below.

Measure =
VAR t =
    SUMMARIZE ( 'Table1', 'Table1'[Customer No], 'Table1'[Contact Date] )
RETURN
    CALCULATE ( COUNTROWS ( t ), ALLEXCEPT ( Table1, Table1[Customer No] ) )

Here is the output.

Capture.PNG

Best  Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

DevDelwyn Frequent Visitor
Frequent Visitor

Re: distinctcount filter different days

That is great @v-piga-msft  thank thankyou :-)

 

I do have a followup query in that I also would like to count just the instances where the Customer Number has repeated on seperate days (excluding the earliest record)

 

i.e from the above data set would return the results as follows

Customer NoMeasure
AA012
AA021
AA030

 

I have tried variations on your previous solution but again am coming up short.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 48 members 683 guests
Please welcome our newest community members: