Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi All,
I'm trying to create a measure that will COUNT or SUM the continuing people on a course. For example, table bellow:
Trainee 1
Trainee 1 singed up to programme with a Participation start date 01/02/2015
In May Trainee 1 withdraw with actual end date of 15/05/2015
Trainee 1 then signed up to another programme end of May with a Participation start date of 30/05/2015
Trainee 1 then completed programme with actual end date of 21/11/2015
Month Signups Continuing Completions Withdrawals Net
Jan 0 0 0 0 0
Feb 1 1 0 0 1
Mar 0 1 0 0 0
Apr 0 1 0 0 0
May 1 1 0 1 0
Jun 0 1 0 0 0
Jul 0 1 0 0 0
Aug 0 1 0 0 0
Sep 0 1 0 0 0
Oct 0 1 0 0 0
Nov 0 1 1 0 -1
Dec 0 0 0 0 0
I have the start date and end date, and that is how I filter the date signups and completions, but still unsure how to have the continuing ones, any advice is much appreciated
Could you please clarifry what it is you are trying to calculate?
I'm trying to calculate the CONTINUING column, as that's the one I don't have on my tables
Hi there,
The "Continuing" measure can be modelled as a variation on 'events in progress', but in your case you want to count how many programmes are in progress at a point in time that were already in progress earlier.
(See this paper for events in progress: http://www.sqlbi.com/wp-content/uploads/DAX-Query-Plans.pdf)
I have created an example model that you can play with, by modifying the code on page 27 of the above paper 🙂
PBIX file here:
https://www.dropbox.com/s/qnfv05chw49692w/Events%20continuing%20on%20date.pbix?dl=0
The "Continuing" measure looks like this (using the code from the SQLBI paper as a starting point):
Continuing =
SUMX (
FILTER (
GENERATE (
ADDCOLUMNS (
CALCULATETABLE (
SUMMARIZE (
CourseData,
CourseData[Signup Date],
CourseData[Withdrawal Date],
CourseData[Completion Date],
"Rows", COUNTROWS ( CourseData )
),
ALL ( 'Date' )
),
"EndDate", MAX ( CourseData[Withdrawal Date], CourseData[Completion Date] )
),
DATESBETWEEN ( 'Date'[Date], CourseData[Signup Date] + 1, [EndDate] )
),
'Date'[Date] = MIN ( 'Date'[Date] )
),
[Rows]
)The measure works by:
All the best,
Owen 🙂
I have a similar situation in several of my reports and this looks like a better solution than what I've been doing. However this measure gives me an error:
Error Message: MdxScript(Model) (14, 4) Calculation error in measure 'locks'[Continuing]: An invalid numeric representation of a date value was encountered. Stack Trace: Invocation Stack Trace: Activity ID 90f6fde6-85be-4097-ed89-742c2438c001 Time Wed May 11 2016 10:01:04 GMT-0400 (Eastern Daylight Time) Version 2.34.4372.322 (PBIDesktop)
I removed the ADDCOLUMNS piece of your measure because I only have one end date to contend with, so no need to pick between two options there. Otherwise I believe I've done everything else identically to yours. Any idea what to do about that error?
Continuing = SUMX ( FILTER ( GENERATE ( CALCULATETABLE ( SUMMARIZE ( locks, locks[startdate], locks[enddate], "Rows", COUNTROWS ( locks ) ), ALL ( DateTable ) ), DATESBETWEEN ( DateTable[Date], locks[startdate], locks[enddate] ) ), DateTable[Date] = MIN ( DateTable[Date] ) ), [Rows] )
Proud to be a Super User!
Not sure...
I googled that error and a few results came up like this one from March 2015:
It seems that in some version of DAX, DATESBETWEEN could return this error when date arguments don't appear in the date table, but I can't reproduce the error in Power BI Desktop.
I see you're using the latest version of Power BI Desktop (2.34) as well.
Could you provide a link to a santisied model that produces the error?
Here we see the dangers of recycling.
My generic date table that I use in most reports runs from 2010-2020. It doesn't actually map all that well to the particular dataset I'm testing this on, because there are start dates as early as 2000. I never altered the date table because I only needed to report after 2010, but this formula doesn't share my lazy attitude toward filtering. I changed the date table's range and it works perfectly.
Proud to be a Super User!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!