DAX Formula for Running Totals (Student Database)

GiacTorrence

New Member
Joined
Dec 2, 2014
Messages
40
Hi all,

I'm having some issues refining a DAX measure that will calculate the running total for students in a given data set. Essentially, this is what my data look like

Table Name: STUD

[TABLE="width: 643"]
<tbody>[TR]
[TD]Headcount[/TD]
[TD]Academic Year[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Discipline[/TD]
[TD]2008/09[/TD]
[TD]2009/10[/TD]
[TD]2010/11[/TD]
[TD]2011/12[/TD]
[TD]2012/13[/TD]
[TD]2013/14[/TD]
[TD]2014/15[/TD]
[TD]2015/16[/TD]
[TD]2016/17[/TD]
[TD]2017/18[/TD]
[/TR]
[TR]
[TD]Business & Applied Studies[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]222[/TD]
[/TR]
[TR]
[TD]Tourism & Hospitality Management[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]222[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]

I'm not sure whether I need specific dates to make this function work (as most examples include specified dates), but any help would be greatly appreciated!

Darko
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Your data isn't very well structured for use in Power Pivot. You want to use the Query Editor to unpivot the data so that you have only three columns; Discipline, Academic Year, and Headcount. You also want your Academic Year column to be a number or a date, if it's really important that the year be formatted like that then add a calendar table that does the conversion.

I'm not quite sure I understand what a running total of headcount looks like, but assuming you just want to add the figures for prior year then you just want something like.

Code:
:=CALCULATE (
    SUM ( STUD[Headcount] ),
    FILTER (
        ALL ( STUD[Academic Year] ),
        STUD[Academic Year] <= MAX ( STUD[Academic Year] )
    )
)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top