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
Anonymous
Not applicable

Cumulative Count Column by Group

Hi there!

 

I am trying to implement a column like so:

 

animalcount
cat1
dog1
mouse1
cat2
dog2
mouse2
cat3
mouse3
cat4
dog3
mouse4

 

Where for each instance of animal, a count is incremented. Essentially, it is 3 independant counters, each counting the occurance of that animal.

 

Any thoughts?

 

Thanks!

 

Im trying something like this at the moment:

 

Count =

VAR countCat = CALCULATE(RANKX('Table','Table'[Animal],,ASC,Dense), FILTER('Table','Table'[Animal]="Cat"))

return countCat 

 

I will have the other animals as VARs as well and an if statement in my return statement to assign values for each row.

 

 

 

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Hi

 

First add an Index Column from the Query Editor

 

Then you can RANK based on that Index to get the desired calcualted column

i.e

 

Count =
RANKX (
    FILTER ( Table1, Table1[animal] = EARLIER ( Table1[animal] ) ),
    [Index],
    ,
    ASC
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Hi

 

First add an Index Column from the Query Editor

 

Then you can RANK based on that Index to get the desired calcualted column

i.e

 

Count =
RANKX (
    FILTER ( Table1, Table1[animal] = EARLIER ( Table1[animal] ) ),
    [Index],
    ,
    ASC
)

Regards
Zubair

Please try my custom visuals

@Anonymous

 

File attached as well

 

cumulativeA.png


Regards
Zubair

Please try my custom visuals

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.