cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rajanikanthr Frequent Visitor
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
Highlighted
Super User
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] )
    )
)

View solution in original post

v-xjiin-msft Super Contributor
Super Contributor

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

@rajanikanthr

 

To achieve your requirement, you can add VALUES() at the end of your expression. Please refer:

 

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

111.PNG

 

Thanks,
Xi Jin.

View solution in original post

3 REPLIES 3
Highlighted
Super User
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] )
    )
)

View solution in original post

v-xjiin-msft Super Contributor
Super Contributor

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

@rajanikanthr

 

To achieve your requirement, you can add VALUES() at the end of your expression. Please refer:

 

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

111.PNG

 

Thanks,
Xi Jin.

View solution in original post

rajanikanthr Frequent Visitor
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..

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 176 members 2,337 guests
Please welcome our newest community members: