Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Power BI Count number of repeating ID

Tags:

powerbi

How do I count repeating ID? I want to put it on the new column, it really doesn't matter if the number of total is repeating example like (if out come is this then better):

==========|=
   10327  |2
   10327  |2
   10328  |3
   10328  |3
   10328  |3

RepeatingID

like image 258
Shulz Avatar asked Jan 18 '26 02:01

Shulz


1 Answers

Use a calculated column like this:

NrOfOccurrences = CALCULATE(
    COUNT([OrderID]); 
    FILTER(Orders; [OrderID] = EARLIER('Orders'[OrderID])))

From bottom to top:

  • FILTER gives you a table per row that has all rows with the same OrderID
  • COUNT would count the number of OrderIDs, effectively the number of rows
  • CALCULATE puts them together, so that the number of rows in the relevant FILTER table is counted;

For example this is a screenshot of a manually entered table:

example table

like image 103
Jeroen Avatar answered Jan 21 '26 09:01

Jeroen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!