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! Learn more

Reply
ab2022
Frequent Visitor

Unique count on same table subgroup data

I am new to Power BI DAX coding. I’m trying to figure out how to create a measure to unique count

1. How many ProductID counts that have at least 1 comment
2. How many  ProductID counts that don't have any comment?

Any tips or guidance it would be very much appreciated.

The data look something like this:

 

DeptIDProductIDInspectorIDInspectorComments
1A10110Needs improvement 
1A10120null
1A10130Waiting for solution from engineers
2B20110null
2B20115null
2B20130null
2B20140null
2B2111Ref. to factory
2B2112Waiting for approval
2B2113Waiting for parts
2B2114Waiting for customer response
3C3015No respone from customer
3C3025Wrong parts
3C3036Waiting for parts
3C3047null


Expect result

DeptIDProductIDInspectorComments 
1A101Yes 
2B201No 
2B211Yes 
3C301Yes 
3C302Yes 
3C303Yes 
3C304No 


Unique ProductIDs count have at least 1 comments : 5
Unique ProductIDs count that do not have any comments at all : 2

Thanks in advance.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@ab2022@tamerj1 beat me to the punch but posting my very similar solution here since I took the time to create it. PBIX is attached below sig.

 

YesNo = IF(COUNTROWS(FILTER('Table',[InspectorComments] <> BLANK())) + 0 > 0,"Yes","No")

Unique ProductIDs with Comments = COUNTROWS(FILTER(SUMMARIZE('Table',[DeptID],[ProductID],"__YesNo",[YesNo]),[__YesNo] = "Yes")) + 0

Unique ProductIDs without Comments = COUNTROWS(FILTER(SUMMARIZE('Table',[DeptID],[ProductID],"__YesNo",[YesNo]),[__YesNo] = "No")) + 0


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@ab2022@tamerj1 beat me to the punch but posting my very similar solution here since I took the time to create it. PBIX is attached below sig.

 

YesNo = IF(COUNTROWS(FILTER('Table',[InspectorComments] <> BLANK())) + 0 > 0,"Yes","No")

Unique ProductIDs with Comments = COUNTROWS(FILTER(SUMMARIZE('Table',[DeptID],[ProductID],"__YesNo",[YesNo]),[__YesNo] = "Yes")) + 0

Unique ProductIDs without Comments = COUNTROWS(FILTER(SUMMARIZE('Table',[DeptID],[ProductID],"__YesNo",[YesNo]),[__YesNo] = "No")) + 0


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
tamerj1
Super User
Super User

Hi @ab2022 

Please try  

Measure

InspectorComments =
IF ( ISEMPTY ( VALUES ( 'Table'[InspectorComments] ) ), "No", "Yes" )

Measure

Count Yes =
SUMX (
    SUMMARIZE ( 'Table', 'Table'[DeptID], 'Table'[ProductID] ),
    IF ( [InspectorComments] = "Yes", 1 )
)

Measure

Count No =
SUMX (
    SUMMARIZE ( 'Table', 'Table'[DeptID], 'Table'[ProductID] ),
    IF ( [InspectorComments] = "No", 1 )
)

 

Hi Greg_Deckler,

Thank you so much for your solution🙂. It took me couple days to search on Internet, but  could not figure it out.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.