Switch query

I want to evaluate possible values of a field, "Edit_count", which is of type ChangeCounter. Based on those, I then change the value or don't change it, of another field.

 

I am trying a switch statement like this, but it throws the error "sequence contains no elements". Where am I going wrong?

 

SWITCH([Edit_count], < 1, COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 1, 1, COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 0, > 1, COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 0)

 

Solved Solved
0 13 236
1 ACCEPTED SOLUTION

It is difficult to opine without knowing more details, but it sounds your entire expression should be as follows

IFS(

[Edit_count] <=1  ,COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 1,
[Edit_count] > 1 , COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 0

)

I think your expression was not throwing error based on first part of the expression which seemed to be syntactically correct and I think remaining expression was ignored by the editor.

IFS(([Edit_count] <1) ,COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 1)
([Edit_count] = 1) , COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 1
([Edit_count] > 1) , COUNT(FILTER("Hazard", [Machine] = [_THISROW].[Machine])) + 0

 

View solution in original post

13 REPLIES 13
Top Labels in this Space