Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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.
Thanks in advance,
Greg
Solved! Go to Solution.
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
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
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]).
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
124 | |
79 | |
50 | |
38 | |
38 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |