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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MichaelF1
Helper III
Helper III

Cumulative total of a constant

Hey everyone,

This looks like it should be a simple problem, but I'm struggling with it!

 

How do I calculate a cumulative total of a constant value?

 

So in the table below, I have created a constant  measure, MY NUMBER and in the Running NUMBER column I want it to show: 13, 26,39,52.

This is what I've tried :

Running NUMBER = CALCULATE([MY NUMBER], FILTER(ALL('Date Table'[YearWeek]), 'Date Table'[YearWeek]<MAX('Date Table'[YearWeek])))
But it just returns the MY NUMBER again, as you can see.

MichaelF1_0-1658416000603.png

Thanks in advance! 🙂

 

1 ACCEPTED SOLUTION

@MichaelF1 

 

 

Running_Target =
VAR _current_week = SELECTEDVALUE('Date Table'[YearWeek])
VAR _weekly_target = [Weekly Target 4wk]
VAR _tbl = 
	ADDCOLUMNS(
		ALLSELECTED('Date Table'[YearWeek]),
		"@Target", _weekly_target
	)
VAR _result = 
	SUMX(
		FILTER(
			_tbl,
			'Date Table'[YearWeek] <= _current_week
		),
		[@Target]
	)

RETURN
	_result

 

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

View solution in original post

4 REPLIES 4
SpartaBI
Community Champion
Community Champion

@MichaelF1 Are you sorting the week by another column?
Also can you check one sec and remove the my number column / measure from the table and tell me what you get

Hi @SpartaBI , thanks for the quick response!

I'm not sorting by any other column.

This is what I get when I remove the Running NUMBER column:

MichaelF1_0-1658416725270.png

 

@MichaelF1 can you PM me to do a quick zoom call?

@MichaelF1 

 

 

Running_Target =
VAR _current_week = SELECTEDVALUE('Date Table'[YearWeek])
VAR _weekly_target = [Weekly Target 4wk]
VAR _tbl = 
	ADDCOLUMNS(
		ALLSELECTED('Date Table'[YearWeek]),
		"@Target", _weekly_target
	)
VAR _result = 
	SUMX(
		FILTER(
			_tbl,
			'Date Table'[YearWeek] <= _current_week
		),
		[@Target]
	)

RETURN
	_result

 

 


2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.