Forum Discussion
Error Made Again Measure
- 5 years ago
Hi Anonymous ,
Not sure I've understood all your prerequisites, but from what I've got:
#Error made again would be 1 if:
- it is the same error and was made later then the first time (Review Period is checked)
- Error Date is not empty
Measure:
#Error Made Again = var currentError = SELECTEDVALUE('T'[Error]) var currentPerson = SELECTEDVALUE('T'[Person]) var currentReviewPeriod = SELECTEDVALUE('T'[Review Period]) var currentErrorDate = SELECTEDVALUE('T'[Error Date]) var firstReviewPeriod = MINX(FILTER(ALL('T'[Person],'T'[Error],'T'[Review Period]), 'T'[Person] = currentPerson && 'T'[Error] = currentError), 'T'[Review Period]) var result = IF(currentErrorDate = BLANK(), 0, CALCULATE( COUNT('T'[Error]), 'T'[Person] = currentPerson, 'T'[Error] = currentError, 'T'[Review Period] > firstReviewPeriod )) return COALESCE(result,0)If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
- 5 years ago
Anonymous Hard to say. I actually mocked this up with the sample data provided and it seems to return the correct results that you want. So, if it isn't working at scale, then there must be some boundary cases that aren't represented in the sample data you provided. So, would need to have more data to figure out what is going on. Can you share your PBIX? I have attached the PBIX I created to test this below sig.
Hi Anonymous ,
Not sure I've understood all your prerequisites, but from what I've got:
#Error made again would be 1 if:
- it is the same error and was made later then the first time (Review Period is checked)
- Error Date is not empty
Measure:
#Error Made Again =
var currentError = SELECTEDVALUE('T'[Error])
var currentPerson = SELECTEDVALUE('T'[Person])
var currentReviewPeriod = SELECTEDVALUE('T'[Review Period])
var currentErrorDate = SELECTEDVALUE('T'[Error Date])
var firstReviewPeriod = MINX(FILTER(ALL('T'[Person],'T'[Error],'T'[Review Period]), 'T'[Person] = currentPerson && 'T'[Error] = currentError), 'T'[Review Period])
var result =
IF(currentErrorDate = BLANK(), 0,
CALCULATE(
COUNT('T'[Error]),
'T'[Person] = currentPerson,
'T'[Error] = currentError,
'T'[Review Period] > firstReviewPeriod
))
return COALESCE(result,0)If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
ERD wonderful, that's it thanks!