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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sharong
Helper I
Helper I

Count by group

Dear Community,

I want a count of customer numbers. below is the table I have now. Except customer number, all three columns are measure results.

I am attaching the expected table output. Can someone help me how to achieve it?

Attaching the sample file: https://drive.google.com/file/d/1pcNYJfbR09naSgqgQSBJlP0AyGvxe9jp/view?usp=share_link 

Current Table:

sharong_0-1670505384079.png

 

Expected output:

sharong_1-1670505439589.png

 

Thanks in advance for any help 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sharong 

Because you are counting the number of customers based on the measurement, you cannot remove Customer No from the visual, and if you remove it, you cannot calculate the corresponding number.

The following is the measure code:

Count_customer = var a=FILTER(ALLSELECTED(Sheet1),[Payment delay persistence only short]="Customer's payment delay category got worse")

var b=FILTER(ALLSELECTED(Sheet1),[Payment delay persistence only short]="Customer didn't change payment delay category")

var c=FILTER(ALLSELECTED(Sheet1),[Payment delay persistence only short]="Customer's payment delay category improved")

return SWITCH(TRUE(),[Payment delay persistence only short]="Customer's payment delay category got worse",COUNTROWS(a),[Payment delay persistence only short]="Customer didn't change payment delay category",COUNTROWS(b),[Payment delay persistence only short]="Customer's payment delay category improved",COUNTROWS(c))

vxinruzhumsft_0-1670565312024.png

 

Best Regards,

Yolo Zhu

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

3 REPLIES 3
Anonymous
Not applicable

Hi @sharong 

Because you are counting the number of customers based on the measurement, you cannot remove Customer No from the visual, and if you remove it, you cannot calculate the corresponding number.

The following is the measure code:

Count_customer = var a=FILTER(ALLSELECTED(Sheet1),[Payment delay persistence only short]="Customer's payment delay category got worse")

var b=FILTER(ALLSELECTED(Sheet1),[Payment delay persistence only short]="Customer didn't change payment delay category")

var c=FILTER(ALLSELECTED(Sheet1),[Payment delay persistence only short]="Customer's payment delay category improved")

return SWITCH(TRUE(),[Payment delay persistence only short]="Customer's payment delay category got worse",COUNTROWS(a),[Payment delay persistence only short]="Customer didn't change payment delay category",COUNTROWS(b),[Payment delay persistence only short]="Customer's payment delay category improved",COUNTROWS(c))

vxinruzhumsft_0-1670565312024.png

 

Best Regards,

Yolo Zhu

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

 

Thanks for the response @Anonymous 

Just another small clarification in the same data. Is it possible to bring the "Payment delay persistence only short" into a filter or a slicer.

 

 

Anonymous
Not applicable

Hi @sharong 

Measure cannot be put into slicer, maybe you can create a calculated column, then put thr column to the slicer

Best Regards,

Yolo Zhu

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

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.