Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
NAOS
Advocate III
Advocate III

Cumulative count with AllSELECTED

Hi all,

 

I have a table of Records with two columns: "Status" and "Activation Date"

 

I use the following measure to return the cumulative count of records per "Activation Date":

Cumulative_count = CALCULATE ( COUNTROWS ( 'Records' ),
FILTER ( ALLSELECTED ( 'Records' ), 'Records'[Activation Date] <= MAX ( 'Records'[Activation Date] )
))

 

I use this measure in a stacked column chart and get the result below:

 

NAOS_0-1698945295452.png

 

What I would like to do next is to add the column legend, so I can split it by "Status". The problem is (I think) that because of the presense of ALLSELECTED, the count is performed again for each "Status" present within each year. So, instead of getting the split of the cumulative count per "Status", I get the following:

 

NAOS_1-1698945652853.png

 

Any suggestion on how to adjust the calculation so I can get the cumulative count of records, but still be able to split it by status in the visual?

Thank you in advance for your help.

 

NAOS

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@NAOS , Create a separate date table and join it with your date and use it

 

Cumulative_count = CALCULATE ( COUNTROWS ( 'Records' ),
FILTER ( ALLSELECTED ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] )
))

 

 

Using window function

 

Cumm Based on Date = CALCULATE(COUNTROWS ( 'Records' ), Window(1,ABS,0,REL, ALLSELECTED('date'[date]),ORDERBY('Date'[date],ASC)))

 

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@NAOS , Create a separate date table and join it with your date and use it

 

Cumulative_count = CALCULATE ( COUNTROWS ( 'Records' ),
FILTER ( ALLSELECTED ( 'Date' ), 'Date'[Date] <= MAX ( 'Date'[Date] )
))

 

 

Using window function

 

Cumm Based on Date = CALCULATE(COUNTROWS ( 'Records' ), Window(1,ABS,0,REL, ALLSELECTED('date'[date]),ORDERBY('Date'[date],ASC)))

 

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak,

 

That makes sense and of course it works.

 

Thank you very much for your help.

 

NAOS

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors