Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Need Help: Count Customers based on filters & Identify New/ Lost Customers

Hi There,

 

I am looking for help to create few measures. My attempts to seek guidance was not fruitful and hence posting here. I have put the datatable below along with expected answer for ease of answering.

 

Below are the 3 questions (more detailed with expected answer in "What measures are needed" tab in attached excel:

 

1. How to calculate the number of customers for whom a certain number of services were rendered?

2. How to identify new customers?

3. How to identify Lost customers?

 

I used this measure but was not able to identify whether it was "Consultancy" or "Implementation" through filters - 

 

One Service Only = SUMX(FILTER(SUMMARIZE(FILTER(DataTable,[Revenue]<>0),DataTable[Customer],"Count of Service",DISTINCTCOUNT(DataTable[Service Rendered])),[Count of Service]=1),1)

 

YearMonthCountryCustomer NameService RenderedDocument noRevenueCash Collected

2015JanUSACustomer 1Consultancy892 $           100 $                     100
2015JanUSACustomer 1Implementation892 $             80 $                       40
2015JanUSACustomer 1Consultancy981 $           240 $                     150
2015JanUSACustomer 2Consultancy989 $           110 $                     100
2015JanUSACustomer 2Implementation1003  $                     100
2015JanUSACustomer 3Implementation1021 $           300 $                     250
2015JanUSACustomer 3Consultancy1021 $           750 $                     500
2015JanUSACustomer 4Consultancy1022 $           180 $                     150
2015FebUSACustomer 1Implementation1055 $           400 $                     340
2015FebUSACustomer 2Implementation1057 $           200 $                     200
2015FebUSACustomer 3Implementation1060 $           600 $                     600
2015FebUSACustomer 5Consultancy1077 $           550 $                     750
2015FebUSACustomer 6Consultancy1087 $             50 $                       75
2015FebUSACustomer 7Consultancy1088  $                       75
2015JanIndiaCustomer 1Consultancy8928080
2015JanIndiaCustomer 1Implementation8926432
2015JanIndiaCustomer 1Consultancy981192120
2015JanIndiaCustomer 2Consultancy9898864
2015JanIndiaCustomer 2Implementation1003 80
2015JanIndiaCustomer 3Implementation1021240200
2015JanIndiaCustomer 3Consultancy1021600400
2015JanIndiaCustomer 4Consultancy1022144120
2015JanIndiaCustomer 4Implementation1022320320
2015FebIndiaCustomer 2Implementation1057 160
2015FebIndiaCustomer 3Implementation1060 480
2015FebIndiaCustomer 5Consultancy1077440600
2015FebIndiaCustomer 6Consultancy10874060
2015FebIndiaCustomer 7Consultancy1088 60

 

 

 

     
  Question:  
 Qn 1In a selected period & Country, how many number of customers in USA & India were provided: 
  # 1Both types of services (i.e., Consultancy & Implementation) 
  Expected Ans:USA in Jan = 2 customer (Customer 1 & 3). Customer 2 had zero revenue on implementation and hence excluded 
     
  # 2Only one type of service (either Consultancy or Implementation) … sum of 3 & 4 below 
  Expected Ans:USA in Feb = 5 customers (Customer 1, 2, 3, 5 & 6). Customer 7 has no revenue and hence excluded 
     
  # 3Only Consultancy Services 
  Expected Ans:USA in Jan = 2 customers (Customer 2 & 4). Customer 2 has zero revenue on Implementation and counted for one type of service count 
     
  # 4Implementation Services 
  Expected Ans:India in Feb = 2 customers (Customer 2 & 3) 
     
  All calculations need to exclude customers who had zero Revenue but had cash collections 
     
 Qn 2In a selected period & country, how many new* customers were made 
  Expected Ans:USA in Feb = 2 customers (Customer 5 & 6). Customer 7 had zero Revenue in Feb and hence excluded 
     
  If a customer was not in the database in any prior month, the customer is identified as new 
  To clarify, a customer for 'consultany' in a prior month is provided 'implementation' services for the first time in the current month is NOT a new customer 
     
 Qn 3In a selected period & country, how many old customers were lost 
  Expected Ans:India in Feb = 3 customers(Customer 1, 2 & 4). Customer 2 is considered as lost customer on account of zero revenue in Feb 
     
  If a customer ceases to have revenue in any month, the customer is identified as Lost in that month 
     

 

Regards

 

Minosh

 

 

 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

 

I'd like to solve this question in steps.  You may refer to my solution to your first question in this PBI file.  For question 4 (Only Implementation services), why should the answer be 2? - there is no billing for Customers 2 and 3 in India in Feb 2015.  In the matrix, i have also shown Customer names for your additional names.  You should be able to drag any field in/out of the filter/matrix.

 

Let me know how this works.  If there are no mistakes, we will proceed to the next questions.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

 

Thank you for the feedback.  Could you kinldy help me with data for a few years so i can correct for the error.  If i add fictitious data, i may still not be able to catch the error.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

20 REPLIES 20
Ashish_Mathur
Super User
Super User

Hi,

 

I'd like to solve this question in steps.  You may refer to my solution to your first question in this PBI file.  For question 4 (Only Implementation services), why should the answer be 2? - there is no billing for Customers 2 and 3 in India in Feb 2015.  In the matrix, i have also shown Customer names for your additional names.  You should be able to drag any field in/out of the filter/matrix.

 

Let me know how this works.  If there are no mistakes, we will proceed to the next questions.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Let me start by saying Thank you Very much! 

 

Yes, you are right that expected answer to Qn 4 is not 2 as they have zero revenue in the period. I should have put it as USA for Feb should be 2 (Customer 5 & 6).

 

Let me look through your PBI file and see if that works.

 

Thanks again

You are welcome.  Look forward to your feedback.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Dear Ashish - This works perfectly! Great work! Thank you!

 

Posting this as Accepted Solution.

 

Would you mind helping on the new clients and lost clients measure?

Hi,

 

I made a minor chage to the Measure "Lost Customers".  Please download the file again.  The link shared earlier should work.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

For new and lost customers, you may downlod the PBI file from here.  Customer 3 is also a lost customer in India in Feb (there was 0 revenue from Customer 3).

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

The new client count DAX formula is not giving desired result. It's calculating the total number of client for a selected period.

Anonymous
Not applicable

Just to add on ... "Date when revenue was first booked" is showing the first date of the period in the data and not the first date of the user selected period. In the sample data that you created, there is only one year and hence not showing the error. Can you please relook at your formula with multi-years.

Hi,

 

Thank you for the feedback.  Could you kinldy help me with data for a few years so i can correct for the error.  If i add fictitious data, i may still not be able to catch the error.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish - Please find data for 2 years

 

YearMonthCountryCustomer NameService RenderedDocument noRevenueCash Collected

2015JanUSACustomer 1Consultancy892 $           100 $                     100
2015JanUSACustomer 1Implementation892 $             80 $                       40
2015JanUSACustomer 1Consultancy981 $           240 $                     150
2015JanUSACustomer 2Consultancy989 $           110 $                     100
2015JanUSACustomer 2Implementation1003  $                     100
2015JanUSACustomer 3Implementation1021 $           300 $                     250
2015JanUSACustomer 3Consultancy1021 $           750 $                     500
2015JanUSACustomer 4Consultancy1022 $           180 $                     150
2015FebUSACustomer 1Implementation1055 $           400 $                     340
2015FebUSACustomer 2Implementation1057 $           200 $                     200
2015FebUSACustomer 3Implementation1060 $           600 $                     600
2015FebUSACustomer 5Consultancy1077 $           550 $                     750
2015FebUSACustomer 6Consultancy1087 $             50 $                       75
2015FebUSACustomer 7Consultancy1088  $                       75
2015JanIndiaCustomer 1Consultancy8928080
2015JanIndiaCustomer 1Implementation8926432
2015JanIndiaCustomer 1Consultancy981192120
2015JanIndiaCustomer 2Consultancy9898864
2015JanIndiaCustomer 2Implementation1003 80
2015JanIndiaCustomer 3Implementation1021240200
2015JanIndiaCustomer 3Consultancy1021600400
2015JanIndiaCustomer 4Consultancy1022144120
2015JanIndiaCustomer 4Implementation1022320320
2015FebIndiaCustomer 2Implementation1057 160
2015FebIndiaCustomer 3Implementation1060 480
2015FebIndiaCustomer 5Consultancy1077440600
2015FebIndiaCustomer 6Consultancy10874060
2015FebIndiaCustomer 7Consultancy1088 60
2014DecUSACustomer 1Consultancy742100100
2014DecUSACustomer 1Implementation7428040
2014DecUSACustomer 1Consultancy755240150
2014DecUSACustomer 2Consultancy765110100
2014DecUSACustomer 2Implementation801 100
2014DecUSACustomer 8Implementation802300250
2014DecUSACustomer 8Consultancy802750500
2014DecUSACustomer 9Consultancy803180150
2014DecIndiaCustomer 1Consultancy8058080
2014DecIndiaCustomer 1Implementation8066432
2014DecIndiaCustomer 1Consultancy809192120
2014DecIndiaCustomer 2Consultancy9118864
2014DecIndiaCustomer 2Implementation911 80
2014DecIndiaCustomer 3Implementation913240200
2014DecIndiaCustomer 3Consultancy913600400
2014DecIndiaCustomer 10Consultancy920144120
2014DecIndiaCustomer 11Implementation921320320
2014DecIndiaCustomer 12Consultancy925320320
Anonymous
Not applicable

Hi Ashish - Were you able to have a look? Please help

Hi,

 

Thank you for sharing the dataset.  Please also let me know in which specific selection scenaio are you getting an incorrect result and what the should be the correct result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

 

Not yet.  i will see it on my weekend.  Please also let me know in which specific selection scenaio are you getting an incorrect result and what the should be the correct result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks much Ashish! I have a problem with this one - it is not the problem with the formula what you did but rather something at my end. I have a report level filter that looks only FY19 Q1 for few other things to work and because of that I am getting "Blank" as count of new clients. So essentially, I am looking to see new clients in FY19 Q1. Would you know how best to fix this?

Hi,

 

I have blogged about my solution to this problem here - Customer analysis by Country and time period.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry, i would not know.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Just to add, when "Services Rendered" is added as a filter and a particular Service is selected, the answers should still be correct

Hi @Anonymous,

 

Have you tried changing the group by order to  DataTable[Service Rendered] and use the count of customer as a measure ?

 

Cheers

 

CheenuSing

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Anonymous
Not applicable

Thanks but that doesn't work.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.