cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GCGradwell
Helper I
Helper I

Average Services per Customer

Hi,

 

I am trying to generate a value which represents the average number of services which each of our customers buy.

 

All of the products we sell fall into 1 of 3 deparments. I want to generate a measure which sums all of the unique customers within each segment together.

 

For clarity:

Thread 3 img.png

 

 

 

In the above example, Customer 100 has bought 2 services from 1 department, 101 has bought 2 services, 1 each from different departments, 102 has bought 1 service and 103 has bought 2 from the same department.

 

In this case, there are 4 overall unique customers (100, 101, 102 and 103) and 5 unique customers by department (100A, 101B, 101C, 102C and 103C).

 

To determine average number of services per customer, I want to divide the sum of each total of unique customers by department by the number of overall unique customers.

 

5/4 = 1.25 average services per cusomer

 

 

Thread 3 img 2.png

 

 

 

I have created a look-up heirarchy in PBI using relationships where the customer ID and product are in the same table and the product's relationship to class and department are linked using relationships.

 

Each product belongs to a Class and each class belongs to a department (e.g. handset 2 is in the iPhone class which is in the Smartphone department). In Power BI, the products have a relationship to a different table, where each product's class is specified. The product class has a relationship to a third table where the department of each product class is specified.

 

I have generated the measure for overall unique customers (DISTINCTCOUNT of customer ID) but do not know how to create a measure for the unique customers by department.

 

Thanks in advance,

 

Greg

1 ACCEPTED SOLUTION
GCGradwell
Helper I
Helper I

Created a new column where I used the CONCATENATE function to combine customer ID and department so that each time a customer purchased an item from different departments, it would be a unique ID-department code, but if they bought multiple products from the same departments, it would generate multiple identical ID-department codes.

 

I then created a new measure using DISTINCTCOUNT function on this concatenated column.

 

Finally, I created a new measure of Average Services per Customer = Unique customers/Unique customers by department

 

Thank you for your help.

 

Greg

View solution in original post

2 REPLIES 2
GCGradwell
Helper I
Helper I

Created a new column where I used the CONCATENATE function to combine customer ID and department so that each time a customer purchased an item from different departments, it would be a unique ID-department code, but if they bought multiple products from the same departments, it would generate multiple identical ID-department codes.

 

I then created a new measure using DISTINCTCOUNT function on this concatenated column.

 

Finally, I created a new measure of Average Services per Customer = Unique customers/Unique customers by department

 

Thank you for your help.

 

Greg

View solution in original post

Eric_Zhang
Microsoft
Microsoft

@GCGradwell

 

According to the relationship mapping, have you tried to create a calculated column in the Invoices table?

 

 

Department = RELATED('Product Class'[DepartMent])

It would return the related department, then you can use DISTINCOUNT('Invoices'[Department]).

 

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors