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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Cumulative count measure

roopesh_1-1599159226881.png

 

I looking to creating a cumulative measure on the patient count.

Patient Count column is 

 

count(table[patienid])

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

Try this one:

RunningTotal1 = 
VAR __year = MAX(TrendingTable[Date_Start_Statusdate].[Year])
RETURN
CALCULATE(
    count(TrendingTable[vw_AccrualsList.patientId]),
    FILTER(allselected(TrendingTable), TrendingTable[Date_Start_Statusdate] <= MAX(TrendingTable[Date_Start_Statusdate]),values(TrendingTable(Year))
    )
)
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

Drag Year and Month from the Calendar Table.  In your visual, sort furst by Year and then by month.  Try this measure

=calculate([patient count],datesbetween(calendar[date],minx(all(calendar),calendar[date]),max(calendar[date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

This what i have done so far

RunningTotal1 = 
VAR __year = MAX(TrendingTable[Date_Start_Statusdate].[Year])
RETURN
CALCULATE(
    count(TrendingTable[vw_AccrualsList.patientId]),
    FILTER(allselected(TrendingTable), TrendingTable[Date_Start_Statusdate] <= MAX(TrendingTable[Date_Start_Statusdate])
    )
)

gives me 

roopesh_0-1599186368409.png

The problem is after December 2018 it has to rest and in January 2019 it has to start from 99 and cumulative and so on.

How do I make it rest after the end of every year?

 

 

Hi @Anonymous 

 

Try this one:

RunningTotal1 = 
VAR __year = MAX(TrendingTable[Date_Start_Statusdate].[Year])
RETURN
CALCULATE(
    count(TrendingTable[vw_AccrualsList.patientId]),
    FILTER(allselected(TrendingTable), TrendingTable[Date_Start_Statusdate] <= MAX(TrendingTable[Date_Start_Statusdate]),values(TrendingTable(Year))
    )
)
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Can you just use the Running Total Quick Measure that is built into the Desktop? In Fields, click the ellipses next to Patient Count and choose Quick Measure and then Running Total.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

roopesh_0-1599165760387.png

 

I added month to and still did not work

RunningTotal = 
CALCULATE(
	COUNTA('TrendingTable'[vw_AccrualsList.patientId]),
	FILTER(
		CALCULATETABLE(
			SUMMARIZE(
				'TrendingTable',
				'TrendingTable'[CurrentStatusDate].[MonthNo],
				'TrendingTable'[CurrentStatusDate].[Month]
			),
			ALLSELECTED('TrendingTable')
		),
		ISONORAFTER(
			'TrendingTable'[CurrentStatusDate].[MonthNo], MAX('TrendingTable'[CurrentStatusDate].[MonthNo]), DESC,
			'TrendingTable'[CurrentStatusDate].[Month], MAX('TrendingTable'[CurrentStatusDate].[Month]), DESC
		)
	)
)
Anonymous
Not applicable

@amitchandak

 

Is there any solution for this?

 

Anonymous
Not applicable

roopesh_0-1599160602646.png

It gives me the running total on years I want it on month jan 2018,feb 2018 etc

RunningTotal = 
CALCULATE(
	COUNTA('TrendingTable'[vw_AccrualsList.patientId]),
	FILTER(
		ALLSELECTED('TrendingTable'[vw_AccrualsList.StatusDate].[Year]),
		ISONORAFTER('TrendingTable'[vw_AccrualsList.StatusDate].[Year], MAX('TrendingTable'[vw_AccrualsList.StatusDate].[Year]), DESC)
	)
)

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors