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

Column count duplicates

Hello
I need to create a column that says how many times the information is repeated in a column.
For example, I have a table where each row represents a sale, and in each of these rows there is the name of the salesperson; I need to create a column in this table that says how many times the seller's name is repeated, without using groupings.

 

Seller DateValueCount
Rafael11/08/20221003
José11/08/20222001
11/08/20223001
João11/08/20224001
Zezinho11/08/20225001
Rafael11/08/20226003
Rafael11/08/20227003
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Create this calculated column formula

=calculate(countrows(Data),filter(Data,Data[seller]=earlier([seller])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
v-jianboli-msft
Community Support
Community Support

Hi @RafaelCM ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

Ashish_Mathur
Super User
Super User

Hi,

Create this calculated column formula

=calculate(countrows(Data),filter(Data,Data[seller]=earlier([seller])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

thank you so much
however I have one more problem, in the dashboard I have a data filter, how do I make this formula obey the data filter? should I create a measure instead of a column? Does this formula also work if you are going to use it in a measure?

This formula's result will not update based on a slicer selection - only measures do.  Why should the count change based on a date slicer selection.  Share some data and show the expected result.  


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
HoangHugo
Solution Specialist
Solution Specialist

Hi

Option 1: create an Summarize Table, use CountX funtion, then Look up back

Option 2:

create measure

        name_seller = SELECTEDVALUE (Seller column)

create column

        count =

              var  a =  measure name_seller

              return COUNTX ( FILTER (table, Seller column = a), Seller column )

 

Multiple solutions posted to similar question, but this is what worked for me.

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.