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
Daniel_G
Frequent Visitor

count of items that only appear once

Hi,

 

I'm looking for a formula that will give me a number of items that appear in table only once.

I can easily do it using pivot table with a count of items = 1 filter, but I don't want a list of such items, but just a total count of them.

 

I tried to do something like X = calculate(count(vendor[No]), count(vendor[No]) = 1), but apparently I can't use count in True/False expressions.

 

Example: In a table, column 'x' I have following values: a,b,a,b,c,b,d. The result of the calculation in that case would 2 (only c and d appear once).

 

Please let me know if you know a solution for that.

 

Thank you in advance,

Daniel

 

 
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

 

Measure =
  VAR __Table =
    SUMMARIZE(
      'Table',
      [column x],
      "__Count",COUNTROWS('Table')
    )
RETURN
  COUNTROWS(FILTER(__Table,[__Count]=1))

 



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

4 REPLIES 4
Anonymous
Not applicable

Hello Daniel,

 

try something like

 

Measure =

VAR varTable =

    ADDCOLUMNS(

        VALUES( vendor[No] ),

        "@Count", 

        VAR varNo = vendor[No]

        VAR varFilterVendor = FILTER( vendor, vendor[No] = varNo )

        RETURN COUNTROWS( varFilterVendor )

    )

VAR varFilterTable =

    FILTER( varTable, [@Count] = 1 )

RETURN

    COUNTROWS( varFilterTable )

 

I did not test this though, so you might have to have a second look at this.

 

Regards

 

Edit: Too late, obviously.

Greg_Deckler
Community Champion
Community Champion

 

Measure =
  VAR __Table =
    SUMMARIZE(
      'Table',
      [column x],
      "__Count",COUNTROWS('Table')
    )
RETURN
  COUNTROWS(FILTER(__Table,[__Count]=1))

 



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...

Hi Greg. I'm doing something similar and this code is very useful for me.


Could I ask what if I wanna add more conditions to this? So I managed to get the count of Unit IDs that appear only once by using your code. But I wanna count the ones that appear once & only if they have "pass" result. Simple data table is as below. I want the total count of it eventually. How do I get to that?

katto16_0-1668580230934.png

 

Thanks in advance!

 

Wow, that was quick 🙂

 

Thanks Greg, works like a charm!

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.

Top Solution Authors