Search code examples
databasepowerbidaxpowerbi-desktopcalculated-columns

CountRows in Power BI


I want a calculated column which shows the number of times a RunnerID appears for a RaceID. There is a maximum of 4 rows per RaceID and each row records a different Type of measure In the Example shown I want a new column where RunnerID 26 will have a COunt of 2 in a new column for both rows and RunnerID 32 and 30 Will show a count a 1 as they only had 1 row each for raceID 3 The Maximum possible count will be 4 as there are only 4 rows for each race in this table The Table has 2000 rows

Many Thanks

enter image description here

I am expecting a new calculated column with a count on each row - The Column will be in the same table


Solution

  • Column = CALCULATE( COUNTROWS('Table'), ALLEXCEPT('Table', 'Table'[RaceID], 'Table'[RunnerID]))