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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count Duplicate Occurences for text fields

Hi, please help in this query wherein i want to count the number of times a value appears row-wise in a separate column "DuplicateCount":-

Should i use measure insted of adding a column?

a shows 2 because it appears 2 times, b shows 3, c shows 4

ValueDuplicateCount
a2
b3
c4
a2
b3
c4
c4
b3
c4
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

As measure

DuplicateCount= calculate(count(Table[Value]),allexcept(Table[Value]))

or

DuplicateCount= calculate(count(Table[Value]),filter(allselected(Table),Table[Value] =max(Table[Value])))

 

 

As a  new column
DuplicateCount= countX(filter(allselected(Table),Table[Value] =earlier(Table[Value])),Table[Value])

 

Actually no visual will repeat value column unless you have an index column or some other column. so Count(Table[Value]) will also do.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,

As measure

DuplicateCount= calculate(count(Table[Value]),allexcept(Table[Value]))

or

DuplicateCount= calculate(count(Table[Value]),filter(allselected(Table),Table[Value] =max(Table[Value])))

 

 

As a  new column
DuplicateCount= countX(filter(allselected(Table),Table[Value] =earlier(Table[Value])),Table[Value])

 

Actually no visual will repeat value column unless you have an index column or some other column. so Count(Table[Value]) will also do.

Pragati11
Super User
Super User

Hi @Anonymous ,

 

Just create a measure as follows:

cntElement = COUNTROWS(yourtablename)

 

Move this measure to a table visual along with your VALUE column.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.