Forum Discussion
Filter Context within variable
- 4 years ago
Hey Turduckin ,
Create a calculated column FallAndWinter:FallAndWinter = VAR CurrentTypeQuarterName = StudentPersistance[Quarter Name] VAR CurrentStudentYearTable = CALCULATETABLE ( StudentPersistance, ALLEXCEPT ( StudentPersistance, StudentPersistance[Student ID], StudentPersistance[Year] ) ) VAR HasWinter = FILTER(CurrentStudentYearTable, StudentPersistance[Quarter Name] = "Winter") RETURN IF (CurrentTypeQuarterName = "Fall", IF ( NOT(ISBLANK(COUNTROWS(HasWinter))), 1 ) )With this you can create a measure to calculate how many of the students are in Fall and Winter in the their first year:
Students in Fall And Winter First Year = VAR CurrentYear = MAX(StudentPersistance[Year]) VAR StudentTable = CALCULATETABLE ( StudentPersistance, ALLEXCEPT ( StudentPersistance, StudentPersistance[Student ID] ) ) VAR FirstFallAndWinter = MINX(FILTER(StudentTable, StudentPersistance[FallAndWinter] = 1), StudentPersistance[Year]) RETURN IF (CurrentYear == FirstFallAndWinter, 1)Total Students in Fall and Winter First Year = SUMX(VALUES(StudentPersistance[Student ID]), _measures[Students in Fall And Winter First Year])You can download the pbix-file here:
https://milanpasschier2.s3.eu-central-1.amazonaws.com/Com+3.pbix
Best,
Milan
Hi Turduckin ,
Goal: "look at records that have the lowest Sequence ID for each Student ID",
get the first Sequence ID of each Student ID:
MIN(StudentPersistance[Sequence ID])
But, "that have a sequential "Fall" [Year] -> "Winter" [Year]."
Can you explain what does it mean or how to calculate that by the following example.
Best Regards
Community Support Team _ chenwu zhu
Hi,
from the screenshot, the expected outcome would be 1 as only student id 11003483 has a Fall and Winter quarter enrollment in their first year.
The Sequence ID may be spurious when what I'm looking for is minimum year. Which, I can get the minimum year when the emplid is provided in a table visualization, but I get confused on how to get that Student ID's minimum year in the variable and have it return that person's min year and not the overall min year.