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

## 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] )
)
)```
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

## 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] )
)
)```
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

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 237 members 2,341 guests
Recent signins: