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.

Solved Solved
0 4 162
1 ACCEPTED SOLUTION

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

View solution in original post

4 REPLIES 4

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.

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

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

Top Labels in this Space