Forum Discussion
Calculation over a moving window
heidibb interesting, I just tested at my end and it is working fine, not sure what we are missing here.
heidibb do you have any other filters, a relationship which will be causing this, for testing, add ALL ( TableName ) and see if it work, although it is not required.
- heidibb6 years agoHelper IV
Yes, there are other filters. Good catch! All didn't work, but ALLSELECTED did:
THANK YOU!!!
- heidibb6 years agoHelper IV
parry2k -- one additional question for you on this cacluation. It's working great, but one additional layer of complexity.. The rolling window for undergraduate terms is 6 terms and the rolling window for graduate terms is 5 terms. I am hoping to have one calculation that does this rolling metric figuring in the different rolling windows. We do have a way to determine the term type of UG and GR, so that can be used as an attribute somewhere.
I thought I could fumble my way through it, but I'm hitting a wall. I am wondering if there is a way to adjust the logic in the __StartRow using the term type criteria?
As a reminder, the current calcuation is:
Rolling Graduated 150% =VAR __currRow = max ( 'Graduation Retention'[DegreeLevelCohortTermAxis])VAR __startRow = __currRow - 5RETURNCALCULATE ([Total Graduated 150%], ALLSELECTED('Graduation Retention'),'Graduation Retention'[DegreeLevelCohortTermAxis] >= __startRow , 'Graduation Retention'[DegreeLevelCohortTermAxis] <= __currRow)- heidibb6 years agoHelper IV
Just to close the loop on this, I think I've figured it out.
I created a UG rate:
Rolling Graduated 150% UG =
VAR __currRow = max ( 'Graduation Retention'[DegreeLevelCohortTermAxis])
VAR __startRow = __currRow - 5
RETURN
CALCULATE ([Total Graduated 150%], ALLSELECTED('Graduation Retention'), 'Academic Program'[AcademicLevelCode] = "UG", 'Graduation Retention'[DegreeLevelCohortTermAxis] >= __startRow , 'Graduation Retention'[DegreeLevelCohortTermAxis] <= __currRow)And a GR rate:
Rolling Graduated 150% GR =
VAR __currRow = max ( 'Graduation Retention'[DegreeLevelCohortTermAxis])
VAR __startRow = __currRow - 4
RETURN
CALCULATE ([Total Graduated 150%], ALLSELECTED('Graduation Retention'), 'Academic Program'[AcademicLevelCode] = "GR",'Graduation Retention'[DegreeLevelCohortTermAxis] >= __startRow , 'Graduation Retention'[DegreeLevelCohortTermAxis] <= __currRow)Then a final measure:
150% = SWITCH(SELECTEDVALUE('Graduation Retention'[Academic Level Code]), "UG", [Rolling Graduated 150% UG] , "GR", [Rolling Graduated 150% GR])