Get value from Enumlist

Yos
Bronze 1
Bronze 1

Hello.
I have a table the table โ€œStudentsโ€, and another table โ€œGroupEventsโ€ in which there are two relevant columns: The column โ€œGroupโ€ contain lists of students names (from enum list input) and the other is called โ€œScoreโ€ and contains a numeric value for each group.

Now, I want to create a new virtual column in the studentsโ€™ table, with the sum of the scores per student.

I wrote the following expression:
sum(select(GroupEvents[Score],in([_thisrow].[StudentName],[Group])))
It keeps return zeros for every student, no matter how many times he has a score with a group.
Iโ€™m struggling with it for a few days and nothing. Can someone help me see what Iโ€™m missing?

Thanks!

Solved Solved
0 8 269
1 ACCEPTED SOLUTION

Your enumlist should be basetype ref and point to the students table. Then the Label will be shown, I guess that the Name is the label in that table

View solution in original post

8 REPLIES 8

Are you sure that the [Score] column is formatted as number and not as text?

Yes. I made sure of it.

So far I know, Enum returns text (default), so you can try to convert the text to number by using the function NUMBER().

Hi.
It is of type Number. please see my reply below.

If the EnumList called [Group] is on the table GroupEvents, itโ€™s basetype Ref and is pointing to the Students table, try:

SUM(
  SELECT(
    GroupEvents[Score],
    IN(
      [_THISROW],
      [Group]
    )
  )
)

Thanks, but the items inside each โ€œgroupโ€ recording are not the key from the table students (not the ID but the names. I guess this is where the problem begins.

Your enumlist should be basetype ref and point to the students table. Then the Label will be shown, I guess that the Name is the label in that table

Yos
Bronze 1
Bronze 1

Iโ€™ve just tested it again. The sumation without the condition works fine and returns a numeric value (sum of all the scores in the GroupEvents table. It is the condition which isnโ€™t working. It looks like it canโ€™t find studentName inside the enum list in the column group.
Iโ€™ve tried FIND(), IN(), CONTAINS() and nothing works. Is it because these expressions work only on type text and not on enum lists?
I guess I still need your help

Top Labels in this Space