Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.