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
aktripathi2506
Helper IV
Helper IV

Adding a new column to count the number of records

Hi,

 

Please consider following senario:

Data is:

 

NameDate
A01/09/2016
A02/09/2016
A03/09/2016
A04/09/2016
A05/09/2016
B01/09/2016
B01/09/2016
B02/09/2016
B02/09/2016
B02/09/2016
B03/09/2016
C05/09/2016
D02/09/2016
E03/09/2016
F04/09/2016
F04/09/2016

 

I want to add a new column to it to have the total number of rows per individual. I don't want measure, I want a column. With measure I know how to do it. my need is with column.

 

Desired output is:

 

NameDateCount
A01/09/20165
A02/09/20165
A03/09/20165
A04/09/20165
A05/09/20165
B01/09/20166
B01/09/20166
B02/09/20166
B02/09/20166
B02/09/20166
B03/09/20166
C05/09/20161
D02/09/20161
E03/09/20161
F04/09/20162
F04/09/20162

 

Please advise.

Thanks.

 

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

an alternative to @KHorseman's solution above would be

 

Alt RowCount = CALCULATE ( COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[Name]) ) 

 

2016-09-29 - Alt RowCount.png 

View solution in original post

3 REPLIES 3
KHorseman
Community Champion
Community Champion

RowCount = CALCULATE(
	COUNTROWS(TableName),
	FILTER(
		ALL(TableName),
		TableName[Name] = EARLIER(TableName[Name])
	)
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Sean
Community Champion
Community Champion

an alternative to @KHorseman's solution above would be

 

Alt RowCount = CALCULATE ( COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[Name]) ) 

 

2016-09-29 - Alt RowCount.png 

KHorseman
Community Champion
Community Champion

Oh yeah, that works too. I've had to do this in a few of my reports recently, but it usually has some other complicated conditions that made the ALLEXCEPT method much messier to write, so I sort of forgot it was an option.





Did I answer your question? Mark my post as a solution!

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.