cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Cumulative count until that row date and for the row field value

I have Date and Feature coming from a source and need to add a Cumulative row count until that date and for that feature

I added sample values for the cumulative count

If I only have one feature , the following formula gives the count fine

CumulativeCount = CALCULATE(COUNTROWS(Registrations),   FILTER (ALL(Registrations), [ApprovedDate] <= MAX([ApprovedDate])))

How to add one more filter to count only rows of Feature value in the current row context?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User III

## Re: Cumulative count until that row date and for the row field value

@rajanikanthr

ALLEXCEPT helps in doing such calculations for sub categories.

Try this

```CumulativeCount =
CALCULATE (
COUNTROWS ( Registrations ),
FILTER (
ALLEXCEPT ( Registrations, Registrations[Feature] ),
[Date] <= MAX ( [Date] )
)
)```
Try my new Power BI game Cross the River
Super Contributor

## Re: Cumulative count until that row date and for the row field value

@rajanikanthr

```CumulativeCount =
CALCULATE (
COUNTROWS ( Registrations ),
FILTER ( ALL ( Registrations ), [ApprovedDate] <= MAX ( [ApprovedDate] ) ),
VALUES ( Registrations[Feature] )
)```

Thanks,
Xi Jin.

3 REPLIES 3
Super User III

## Re: Cumulative count until that row date and for the row field value

@rajanikanthr

ALLEXCEPT helps in doing such calculations for sub categories.

Try this

```CumulativeCount =
CALCULATE (
COUNTROWS ( Registrations ),
FILTER (
ALLEXCEPT ( Registrations, Registrations[Feature] ),
[Date] <= MAX ( [Date] )
)
)```
Try my new Power BI game Cross the River
Super Contributor

## Re: Cumulative count until that row date and for the row field value

@rajanikanthr

```CumulativeCount =
CALCULATE (
COUNTROWS ( Registrations ),
FILTER ( ALL ( Registrations ), [ApprovedDate] <= MAX ( [ApprovedDate] ) ),
VALUES ( Registrations[Feature] )
)```

Thanks,
Xi Jin.

Frequent Visitor

## Re: Cumulative count until that row date and for the row field value

Thanks @Zubair_Muhammad and @v-xjiin-msft ..both solutions worked fine..

Announcements

#### Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

#### Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!