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
PowerBI123456
Post Partisan
Post Partisan

Countrows by ID

Hi, this seems like it would be simple to do, but I cant figure it out. How can I countrows by ID via a measure? For example, ID 1 has 4 rows. Thanks!

 

PowerBI123456_0-1593724482966.png

 

 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @PowerBI123456 

I prefer this one

Measure = CALCULATE(COUNTROWS(Table), ALLEXCEPT(Table, Table[ID]))

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

7 REPLIES 7
az38
Community Champion
Community Champion

Hi @PowerBI123456 

I prefer this one

Measure = CALCULATE(COUNTROWS(Table), ALLEXCEPT(Table, Table[ID]))

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38 Thanks! But that is counting all the rows for me. I want to count it by ID. 

@PowerBI123456 

also you can create a calculated table

New Table = SUMMARIZECOLUMNS('Table'[ID], "Count By ID", COUNT('Table'[ID]))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@PowerBI123456 

it will count rows exactly by ID


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38 

 

See below, I am doing the calc the same way, but its returning the number of total rows in that table. 

 

PowerBI123456_1-1593726196394.png

 

@PowerBI123456 

it depends on visual. if you put in the table [Unique] field and your measure - you will get a desired result

BUT. if you have the only column - [Unique] create a super simple measure

Measure = COUNTROWS('Table')

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38 thanks!

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.