Hi
need to calculate the average based on a condition.
something like this:
| stats avg(fieldB, when field A testing true) as trueV avg(fieldB, when field A testing false) as falseV by Field C
Goal is a table like this:
url | average (true) | average( false).
Try something like this
| eval trueA=if(fieldA=true,fieldB,null())
| eval falseA=if(fieldA=true,null(),fieldB)
| stats avg(trueA) as trueV avg(falseA) as falseV by fieldC
Try something like this
| eval trueA=if(fieldA=true,fieldB,null())
| eval falseA=if(fieldA=true,null(),fieldB)
| stats avg(trueA) as trueV avg(falseA) as falseV by fieldC
Thanks, that works. Now I understand this - this is making two separate 'fields' based on the condition, to avoid having the calculation either in the eval, or in the stats (which both don't work).