Getting ready

To prepare for this recipe, do the following:

  1. Open Power BI Desktop.
  2. Use an Enter Data query to create a table called R05_Table that contains the following data:

Animal

Index

Tiger

1

Tiger

2

Tiger

3

Tiger

4

Tiger

5

Lion

6

Lion

7

Lion

8

Tiger

9

Tiger

10

Elephant

11

Elephant

12

Elephant

13

Tiger

14

Tiger

15

Tiger

16

 

We wish to implement a counter that increments by one for each consecutive row in which there is the same Animal. However, when the Animal changes, we want the counter to start over.