cancel
Showing results for
Did you mean:
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:

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

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.

Greg

1 ACCEPTED SOLUTION
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

Greg

2 REPLIES 2
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

Greg

Microsoft

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]).

Announcements

#### 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.