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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Non-empty running total

Hello everyone,

 

I found this DAX code to calculate a yearly running total :

 

 

 

Qty Invoiced running total in Month = 
CALCULATE(
	SUM('Revenue'[Qty Invoiced]),
	FILTER(
		ALLSELECTED('Revenue'),
		'Revenue'[Year] = MAX ( 'Revenue'[Year] ) &&
        'Revenue'[Month] <= MAX ( 'Revenue'[Month] )
	)
)

 

 

 

I am using the Area chart with the Year in legend to show the yearly difference however my running total stop on the month when I don't have data, to continue on the next one.

Capture.PNG

 

Any clue how I could enhance this measure ?

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous  Use date table that will make sure you have data for the month you do not have data

 

Qty Invoiced running total in Month = 
CALCULATE(
	SUM('Revenue'[Qty Invoiced]),
	FILTER(
		ALLSELECTED('Date'),
		'Date'[Year] = MAX ( 'Date'[Year] ) &&
        'Date'[Month] <= MAX ( 'Date'[Month] )
	)
)

 

to means this seem like YTD only

YTD Sales = CALCULATE(SUM(Revenue[Qty Invoiced]),DATESYTD('Date'[Date],"12/31"))

 

for runnign total

Qty Invoiced running total in Month = 
CALCULATE(
	SUM('Revenue'[Qty Invoiced]),
	FILTER(
		ALLSELECTED('Date'),
		'Date'[DAte]  <= MAX ( 'Date'[Date] )
	)
)

 

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

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous  Use date table that will make sure you have data for the month you do not have data

 

Qty Invoiced running total in Month = 
CALCULATE(
	SUM('Revenue'[Qty Invoiced]),
	FILTER(
		ALLSELECTED('Date'),
		'Date'[Year] = MAX ( 'Date'[Year] ) &&
        'Date'[Month] <= MAX ( 'Date'[Month] )
	)
)

 

to means this seem like YTD only

YTD Sales = CALCULATE(SUM(Revenue[Qty Invoiced]),DATESYTD('Date'[Date],"12/31"))

 

for runnign total

Qty Invoiced running total in Month = 
CALCULATE(
	SUM('Revenue'[Qty Invoiced]),
	FILTER(
		ALLSELECTED('Date'),
		'Date'[DAte]  <= MAX ( 'Date'[Date] )
	)
)

 

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
Anonymous
Not applicable

Hi Amit,

Thanks for the inputs.

I created a date table following this procedure , however whether I write one of the two codes you mentionned my output is incorrect:

Capture.PNG

Am I missing something ?

@Anonymous , hope axis is also coming from date table also check formula, seems like only allselected  and = max is mising

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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
Anonymous
Not applicable

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors