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
Syndicate_Admin
Administrator
Administrator

How to count the service received by a client.

Good day community, I need help to make a count on customers who have received 1 service, 2 services and more.

I have 1 table with the columns: date, clientID and services. A customer can receive 1 or even 5 services, and I want to count how many customers receive service1 and service2, service1 and service3, and so on. I've tried in different ways and I can't succeed. Please ask for help. Here is a sample of the test data.

DateClient IDServices
20/4/2022274S1
21/4/2022274S3
21/3/2022275S2
17/3/2022275S2
17/3/2022275S3
16/2/2022276S1
16/2/2022276S3
2/2/2022276S4
26/2/2022143S1
24/2/2022143S3
2/3/2022143S4
6/4/2022144S1
6/4/2022144S3
28/2/2022145S1
25/2/2022145S3
2/3/2022145S4
25/4/2022146S1
25/4/2022146S3

This is what I want to achieve.

gipro_1-1669148432477.png

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Syndicate_Admin 

 

You can try the following methods. You need to add a column of index in Power Query.

vzhangti_0-1669180444796.png

Column:

Services 2 = 
Var _N1=MINX(FILTER('Table',[Client ID]=EARLIER('Table'[Client ID])&&[Index]<EARLIER('Table'[Index])),[Services])
Var _N2=MAXX(FILTER('Table',[Client ID]=EARLIER('Table'[Client ID])&&[Index]>EARLIER('Table'[Index])),[Services])
Return
IF(_N1=BLANK(),_N2,_N1)
Column = 
Var _a= [Services]&" y "&[Services 2]
Var _b=[Services 2]&" y "&[Services]
Return
IF([Services]<[Services 2],_a,_b)

vzhangti_1-1669180510321.png

vzhangti_3-1669180599638.png

Hope that can help you.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Syndicate_Admin 

 

You can try the following methods. You need to add a column of index in Power Query.

vzhangti_0-1669180444796.png

Column:

Services 2 = 
Var _N1=MINX(FILTER('Table',[Client ID]=EARLIER('Table'[Client ID])&&[Index]<EARLIER('Table'[Index])),[Services])
Var _N2=MAXX(FILTER('Table',[Client ID]=EARLIER('Table'[Client ID])&&[Index]>EARLIER('Table'[Index])),[Services])
Return
IF(_N1=BLANK(),_N2,_N1)
Column = 
Var _a= [Services]&" y "&[Services 2]
Var _b=[Services 2]&" y "&[Services]
Return
IF([Services]<[Services 2],_a,_b)

vzhangti_1-1669180510321.png

vzhangti_3-1669180599638.png

Hope that can help you.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, my apologies for the delay in answering, yes it worked. In order to do the single count of combined services, I created a matrix with a different count of Client ID. Thank you for your prompt help.

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.