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
rajanikanthr
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
Zubair_Muhammad
Community Champion
Community Champion

@rajanikanthr

 

ALLEXCEPT helps in doing such calculations for sub categories.

Try this

 

CumulativeCount =
CALCULATE (
    COUNTROWS ( Registrations ),
    FILTER (
        ALLEXCEPT ( Registrations, Registrations[Feature] ),
        [Date] <= MAX ( [Date] )
    )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

v-xjiin-msft
Solution Sage
Solution Sage

@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
v-xjiin-msft
Solution Sage
Solution Sage

@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.

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

Zubair_Muhammad
Community Champion
Community Champion

@rajanikanthr

 

ALLEXCEPT helps in doing such calculations for sub categories.

Try this

 

CumulativeCount =
CALCULATE (
    COUNTROWS ( Registrations ),
    FILTER (
        ALLEXCEPT ( Registrations, Registrations[Feature] ),
        [Date] <= MAX ( [Date] )
    )
)

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.