Hi all,
I have the following situation with a query returning a table of this kind:
| fieldA | fieldB |
| A | 2 |
| A | 2 |
| B | 4 |
| B | 4 |
I need to add a column to this table that sums up fieldB only once per fieldA unique value, meaning a new column that sums 2+4 = 6
table would look like this:
| fieldA | fieldB | sum_unique |
| A | 2 | 6 |
| A | 2 | 6 |
| B | 4 | 6 |
| B | 4 | 6 |
I know that I have to use | eventstats sum() here but I am struggling how to define it has to be once per fieldA unique value.
Thanks in advance
Miguel
| appendpipe
[| chart values(fieldB) as unique by fieldA]
| eventstats sum(unique) as sum_unique
| where isnull(unique)
| fields - unique
| appendpipe
[| chart values(fieldB) as unique by fieldA]
| eventstats sum(unique) as sum_unique
| where isnull(unique)
| fields - unique
Works great!. Thanks!