Add initial number plus one, for each category, keeping record

Hi, I have 3 types of evaluations Quiz, Sumative and Diagnostic
When I create a new evaluation a need to put as an initial value, a number for each one, starting by 1 and adding one more for the next same type of evaluation created. For ecample
for the first Quiz evaluation initial value 1, then for the second quiz initial value 2 , then if i create a sumative evaluation it should show 1, and then for the next quiz should contiinue with 3 and so on.

Something like:

MAX( SELECT(Evaluations[number] , [type] = [_THISROW].[type] ) ) + 1

Keep in mind that incremental expressions like these will fail if you have more than 1 user adding records at or around the same time.

3 Likes

Thank you very much!!!, i’ll give it a try.

It works!.. but i made a mistake, I forgot to mention that besides “type” there is also a “subject” column.
how could i include both, so that for each --type-subject-- it counts from 1 ++ ?
…Solved! i just made a virtual column concatenate([type].[subject]) and then used that virtual column (uniqueTest) in place of [type]

MAX( SELECT(Evaluations[number] , [uniqueTest] = [_THISROW].[type] ) ) + 1

1 Like

That doesn’t sound correct, but perhaps I’m missing some detail. See also:

2 Likes