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
JuiceX
New Member

Count distinct by one group then sum as another group

Hi all,

 

Trying to find a solution to my issue.

I am trying to count the number of parts by a group but displayed a sum of another group but cant get the distinctcount straight in my mind. Example below

 

 

I want to count the number of unique parts in a quote, then display that as a sum for the month. If you note the last 3 lines are the same part, I want to count that part as one occurance for quote 1017P and one occurance for quote 1022P which would ultimatly sum to 2 for the month of Nov.

 

DATEQUOTE_NOTRIMMED_NUMBER
1/11/20181017PCPGVE-04011
1/11/20181017PCPGVE-04011
1/11/20181017PCPGVE-04110
1/11/20181017PCPGVE-07011
1/11/20181017PCPGVE-10010RH
1/11/20181017PCPGVE-10010RH
1/11/20181017PCPGVE-20010
1/11/20181017PCPGVE-21031LH
1/11/20181017PCPTTH-04020
1/11/20181022PCPTTH-04020
1/11/20181022PCPTTH-04020

 

Expected output

MonthUnique Parts Per Quote
Nov-188

 

Thanks kindly

1 ACCEPTED SOLUTION
affan
Solution Sage
Solution Sage

Hi @JuiceX,

 

You can use the below measure to get the desired result. Replace 'Table1' with your table name.

 

 

Measure = CALCULATE(COUNTX(SUMMARIZE(Table1,Table1[QUOTE_NO],Table1[TRIMMED_NUMBER]),CALCULATE(VALUES(Table1[TRIMMED_NUMBER]))))

I have tested the same and I got the below result

Distinct.png

 

 

 

 

 

If this helped you, please mark this post as an accepted solution and like to give KUDOS .

 

Regards,

Affan

 

View solution in original post

2 REPLIES 2
affan
Solution Sage
Solution Sage

Hi @JuiceX,

 

You can use the below measure to get the desired result. Replace 'Table1' with your table name.

 

 

Measure = CALCULATE(COUNTX(SUMMARIZE(Table1,Table1[QUOTE_NO],Table1[TRIMMED_NUMBER]),CALCULATE(VALUES(Table1[TRIMMED_NUMBER]))))

I have tested the same and I got the below result

Distinct.png

 

 

 

 

 

If this helped you, please mark this post as an accepted solution and like to give KUDOS .

 

Regards,

Affan

 

Excellent, works, thankyou!!

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.

Top Solution Authors