Forum Discussion
Rolling Semester (Half Year)
- Anonymous7 years ago
I attached the PBIX file below because had to do some work in Power Query to get the data set up since there is no dedicated Calendar table. Easier to look at the file instead of me listing out all the steps.
The end result is:
That Index column above is what I was going after. That Calculated Column is:
Index = VAR CurrentDate= 'RollingSemester'[Date] RETURN CALCULATE( DISTINCTCOUNT('RollingSemester'[FySemID]), FILTER( ALL( 'RollingSemester'), CurrentDate >= RollingSemester[Date] ) )With that Index, I can set the min and max of the previous semester:
Min of Prev Index = CALCULATE( MIN('RollingSemester'[Date]), FILTER( ALL( 'RollingSemester'), RollingSemester[Index] = MAX( RollingSemester[Index]) -1 ) ) Max of Prev Index = CALCULATE( MAX('RollingSemester'[Date]), FILTER( ALL( 'RollingSemester'), RollingSemester[Index] = MAX( RollingSemester[Index]) -1 ) )Now that we have the min and max of what we want to average, can use that a few ways. I decided to use DATESBETWEEN:
Average of Actual Rate = AVERAGE(RollingSemester[Actual Rate]) Applied Rate = IF( MAX('RollingSemester'[Index]) <> 1, CALCULATE( [Average of Actual Rate], DATESBETWEEN( 'RollingSemester'[Date], [Min of Prev Index], [Max of Prev Index] ) ) )Then if you want to show the actual rate if there, or the average if not in one column can use:
Actual and Applied one Measure = IF ( ISBLANK([Average of Actual Rate]),[Applied Rate],[Average of Actual Rate])
Might not be 100% what you were looking for, but should hopefully be a good starting point
It does. I'm just not entirely sure what you are after. How'd you get that 15.67% number?
Anonymous it's the average of the previous semester which is the measure I'm trying to create
- Anonymous7 years agoNot applicable
I attached the PBIX file below because had to do some work in Power Query to get the data set up since there is no dedicated Calendar table. Easier to look at the file instead of me listing out all the steps.
The end result is:
That Index column above is what I was going after. That Calculated Column is:
Index = VAR CurrentDate= 'RollingSemester'[Date] RETURN CALCULATE( DISTINCTCOUNT('RollingSemester'[FySemID]), FILTER( ALL( 'RollingSemester'), CurrentDate >= RollingSemester[Date] ) )With that Index, I can set the min and max of the previous semester:
Min of Prev Index = CALCULATE( MIN('RollingSemester'[Date]), FILTER( ALL( 'RollingSemester'), RollingSemester[Index] = MAX( RollingSemester[Index]) -1 ) ) Max of Prev Index = CALCULATE( MAX('RollingSemester'[Date]), FILTER( ALL( 'RollingSemester'), RollingSemester[Index] = MAX( RollingSemester[Index]) -1 ) )Now that we have the min and max of what we want to average, can use that a few ways. I decided to use DATESBETWEEN:
Average of Actual Rate = AVERAGE(RollingSemester[Actual Rate]) Applied Rate = IF( MAX('RollingSemester'[Index]) <> 1, CALCULATE( [Average of Actual Rate], DATESBETWEEN( 'RollingSemester'[Date], [Min of Prev Index], [Max of Prev Index] ) ) )Then if you want to show the actual rate if there, or the average if not in one column can use:
Actual and Applied one Measure = IF ( ISBLANK([Average of Actual Rate]),[Applied Rate],[Average of Actual Rate])
Might not be 100% what you were looking for, but should hopefully be a good starting point
- Anonymous7 years agoNot applicable
Anonymous thanks a ton man, this is perfect!
I had tried using the datesinperiod function based off a semester start date, but creating a pairing end date and using datesbetween works much better. Really appreciate the help.
- Anonymous7 years agoNot applicable
Glad it helped!