Forum Discussion
PrabodhPurwar
Microsoft Employee
5 years agoCalculate the previous data
Hello Team , I want to calculate the previous data before the time period id date status 1 1-May open 1 30-Apr closed ...
Anonymous
5 years agoNot applicable
[ID Count (Open Before)] =
// There must be a field in the
// table T that is a true date
// not a string. Assume the
// field is called date. Then:
var MinDateSelected = MIN( T[date] )
return
CALCULATE(
DISTINCTCOUNT( T[id] ),
KEEPFILTERS( T[status] = "open" ),
T[date] < MinDateSelected
)
// Note well that you should not have
// models with one table only but
// build a star schema. If you don't
// do this, you are risking creating
// a lot of issues, one of them being
// correct measures that produce incorrect
// results. You've been warned!