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
n2p2gupta
Frequent Visitor

Calculate cumulative count by looking values in a column

How can I create a column "Result" below by keepin a count of repeating values from Col1?  Thanks.

Col 1    Result

   a              1

   b              1

   a              2

   c              1

   b             2

   a             3

   c             2

3 REPLIES 3
n2p2gupta
Frequent Visitor

Thanks Eric!


@n2p2gupta wrote:

Thanks Eric!


@n2p2gupta

If you have no further question, could you accept the reply as solution to close this thread? For any question, feel free to post.

Eric_Zhang
Employee
Employee


@n2p2gupta wrote:

How can I create a column "Result" below by keepin a count of repeating values from Col1?  Thanks.

Col 1    Result

   a              1

   b              1

   a              2

   c              1

   b             2

   a             3

   c             2


@n2p2gupta

You need an index column to indicate the rows order.

Capture.PNG

 

Then create a calculated column as

Result =
RANKX (
    FILTER ( 'Table', 'Table'[Column1] = EARLIER ( 'Table'[Column1] ) ),
    'Table'[Index],
    ,
    ASC,
    DENSE
)

Capture2.PNG

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.

Top Kudoed Authors