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
ADSL
Post Prodigy
Post Prodigy

Count the Number of Customer Order in Current Month vs. Last 03 month

Hi BI Community Team,

 

I have 02 tables of sales order on the current month --- Nov'22 & last 03 month --- Aug'22 till Oct'22.

 

Nov'22.png

 

L3M.png

 

And we want to find & count the "New Customer" by sales rep in Nov'22. In excel, we filter by sales rep code of both tables and mapping of customer code if there are no duplicate of red color in Nov'22 then it's called "New Customer". It's taking so long time to do one by one of sales rep.

 

Any suggestion of measure in power to calcuate it?

 

Thanks and Regards,

 

 

17 REPLIES 17
Aburar_123
Resolver IV
Resolver IV

Hi @ADSL ,

 

Please find the below logic,

 

Aburar_123_0-1672484402526.png

 

 

Please Accept this post as a Solution if it solves your problem. Thanks.

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Hi @Ashish_Mathur ,

 

As per your file result are count and show only 05 but I am manually count in excel and found 17 for this sales rep - 10750175

 

2022-12-30_10-03-05.png

 

Thanks and Regards,

Hi,

There are 2 conditions i am testing for.  If November is selected, then there should be a sale in November and sum of sales in the previous 3 months should be 0.  Apply the same conditions to your dataset. 


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

Hi @Ashish_Mathur,

 

Here is the report expection that finding "New" customer. customer order in current month vs. last 03 month:

 

If November is selected, then customer order in November will be mapping with sales order for last 03 months.

 

If it found customer have no order in last 03 month and only have in November then it's call "New Customer". 

 

Any suggestion? 

What do you mean by "Here is"?


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

Hi @Ashish_Mathur,

 

I mean that if you can check and review the question again because I am concern the previous post was not clear.

 

However you always supported and provided the suggestion. Thank you for your helpful feedback.

 

Thanks and Regards,

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png

 


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

Hi,

 

Refer to below sample data.

 

NewSales table data:

HiraNegi_0-1672221984257.png

 

OldSales table data:

HiraNegi_1-1672222019698.png

 

Create measure in NewSales table to check if the Customer is new or old.

Note: This does not require relationship between the two tables.

 

CheckNewCustomers =
var vCustomer = SELECTEDVALUE(NewSales[Customer])
var vSalesman = SELECTEDVALUE(NewSales[Salesman])
var vOldSales = CALCULATETABLE(OldSales, FILTER(OldSales, OldSales[Customer] = vCustomer),
    FILTER(OldSales, OldSales[Salesman] = vSalesman))
Return
IF(COUNTROWS(vOldSales) >= 1, "Old", "New")

 

 

This will give you the results like below from NewSales table.

HiraNegi_4-1672222265341.png

 

Hope this helps!

 

Hi @HiraNegi,

 

After trying your suggestion, we are able to see the "New" & "Old" customer as the screenshot below.

 

2022-12-29_10-21-40.png

Any suggestion if we want to see and count the "New" customer only as the screenshot below? 

 

2022-12-29_10-24-57.png

Thanks and Regards,

 

Hi @ADSL ,

 

Once you have a measure to categories New and Old customer, you can create another measure to take the count like below.

 

NewCustomerCount = CALCULATE(COUNT(NewSales[Customer]), FILTER(NewSales,[CheckNewCustomers] = "New"))

 

HiraNegi_0-1672287066903.png

 

Hi @HiraNegi ,

 

It has some variant number counting of New customer after followed your measure suggestion above. Please check the screenshot below.

 

1st measure, it's only 17.

 

2nd measure, it's 72 customer.

 

2022-12-30_10-13-21.png

Hi @ADSL ,

 

Not sure what is the data granularity of your report. But can you try using DISTINCT to measure expression like below.

 

NewCustomerCount = CALCULATE(DISTINCTCOUNT(NewSales[Customer]), FILTER(NewSales,[CheckNewCustomers] = "New"))
 
Regards,
Hira Negi
FreemanZ
Super User
Super User

hi @ADSL 

 

try to 

1) get a customer list from Aug to Oct, like CALCULATETABLE(VALUES(), FILTER(...))

2) get a customer list in Nov

3) make an EXCEPT of the two

 

If you need further suggestion, consider provide some sample raw data and @me. 

Hi @FreemanZ,

 

I am a new Power BI user then still need your suggestion and detail of measure.

 

Here is the link of sample pbix file - https://drive.google.com/drive/folders/1lACpCBHOAjWBbdTijkLjzc62hUOU9CMM?usp=sharing 

 

Thanks and Regards,

hi @ADSL 

Could you paste a table here?

as Google is blocked here.😂

Hi @FreemanZ ,

 

I am unable to post the attachment file and only share the link to download.

 

However you can see the screenshot below as the sales order that it's the same format from Aug'22 till Nov'22.

 

https://drive.google.com/drive/folders/1lACpCBHOAjWBbdTijkLjzc62hUOU9CMM?usp=sharing 

 

 

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.