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
KWB
Frequent Visitor

How to summarise number of customers by usage

How do I summarise the number of customers by the number of times they have used a service?

 

The data is unique to customer level, including a unique ID. Therefore if they have used a service three times, they will appear in the data set as three rows. This is an example of the sort of graph I'd like to create:

 

Users.PNG

 

 

 

However, to do this so far, I have had to summarise the data as a view using SQL and isolating this dataset from the model, but it would be more efficient and useful to be able to do this in Power BI Desktop.

 

Ideally I'd like to keep the data as it is because there are dimension IDs that link to customers information, such as City or Job that may change each time they use the service, so I need to be able to retain that dimension ID.

 

Many thanks in advance

5 REPLIES 5
v-yulgu-msft
Employee
Employee

Hi @KWB,

 

Suppose your data view looks like:

1.PNG

 

To achieve your requirement, please first create a calculated column using below DAX formula:

Number of Times =
CALCULATE (
    COUNT ( summarise[Customer ID] ),
    ALLEXCEPT ( summarise, summarise[Customer ID] )
)

In visual, drag this new column into Axis setion and drag [Customer ID] into value section. Please be aware that you should select Count(distinct) from drop down list.

2.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


@v-yulgu-msft wrote:

Hi @KWB,

 

Suppose your data view looks like:

 

 

To achieve your requirement, please first create a calculated column using below DAX formula:

Number of Times =
CALCULATE (
    COUNT ( summarise[Customer ID] ),
    ALLEXCEPT ( summarise, summarise[Customer ID] )
)

In visual, drag this new column into Axis setion and drag [Customer ID] into value section. Please be aware that you should select Count(distinct) from drop down list.

 

 

Best regards,
Yuliana Gu


 

Thanks Yuliana, it works as a total of the table. For example, one customer might have a total of 6 uses of the service across two years, say 3 in 2015 and 3 in 2016. If a year is selected, the uses still stays at 6 rather than three, so it doesn't seem possible to segment the total of the table.

Hi @KWB,

 

In my test, the count values will also change depend on the selection of year from slicer.

 

Would you please share your sample data so that I can test for you?

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for your time, @v-yulgu-msft:

 

I created a very basic set of test data:

 

Usage1.JPG

 

If I use your calculation, the whole table works:

 

Total used.JPG

Customer1, Customer3 and Customer4 have used it one time and Customer2 has used it two times.

 

The problem is when I select a filter (in this example, year is in the main table, but in reality is in a calendar dimension):

 

2016 used.JPG

For 2016, Customer2 has used it once, Customer4 has used it once. But the data shows one customer has used it once and once customer has used it twice. I suspect the latter is because Customer4 appears twice in the whole table and selecting 2016 doesn't affect that.

 

2017 used.JPG

For 2017, Customer1, Customer2 and Customer3 have used the service once. Again, Customer 2 seems to be counted twice, rather than once.

 

Hope that makes sense? Thanks for your assistance.

 

Regards

spuder
Resolver IV
Resolver IV

Hi,

 

for me it looks like a job for the custom visual (Histogram)

 

Another solution for histograms can be seen here.

 

https://powerbi.microsoft.com/en-us/documentation/powerbi-service-histograms/

 

Maybe it helps

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.