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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

New column to count number of instances in same table

Hi,

 

Hope someone can help with the following please:

 

I have the below TableA:

Person_IDSessionCategory

11

Short Day
22Full Day
11Full Day
33AM

 

I want to add a column to this table which shows the number of rows which contain the same Person_ID, such as the below:

Person_IDSessionCategoryRepeatedID

11

Short Day2
22Full Day1
11Full Day2
33AM1

 

I don't want to remove any rows at this stage, as I need to use the above to create two other tables filtered on a) Person_IDs showing just once, and b) Person_IDs that show 2 or more times.

 

Please can you advise how I can achieve this?

I have tried the following but I am receiving an error stating "The function COUNTX cannot work with values of type Boolean". (I have the column set to Data Type "Whole number".)

 

RepeatID =
var Test =
        TableA[Person_ID]
RETURN
        COUNTX(TableA, TableA[Person_ID] = Test)

Many thanks. 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Anonymous 
Please add a calculated column with the dax formula = 

repats = CALCULATE(count('Table'[Person_ID]),ALLEXCEPT('Table','Table'[Person_ID]))
Ritaf1983_0-1701706288493.png

the pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
bhanu_gautam
Super User
Super User

Thanks @Ritaf1983 this works




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






@bhanu_gautam 
Glad to help 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

Hi @Anonymous 
Please add a calculated column with the dax formula = 

repats = CALCULATE(count('Table'[Person_ID]),ALLEXCEPT('Table','Table'[Person_ID]))
Ritaf1983_0-1701706288493.png

the pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors