total a column in OMS

Copper Contributor

Hello,

 

How can I sum a column?

I have each row dcount with number of customers and I would like to know what is the total of customers.

I want to present a new row with the total number of customers

or even a new column that shows the same number on each row.. (I dont mind how the visualisiation will look like, need the total number)

 

Thanks!

4 Replies

Hi Tal,

To only get the sum of the dcount value, you can do something like the bottom line here:

Update
| summarize dcount(Product) by Computer
| summarize sum_dcount=sum(dcount_Product)

To add the summed value to each row, you can do this:

let summed_dcount_products_by_computer=
Update
| summarize dcount(Product) by Computer
| summarize sum_dcount=sum(dcount_Product);
Update
| extend summed_dcount=toscalar(summed_dcount_products_by_computer)

HTH,

Noa

Hi Noa,

 

Thanks, but when I do this

| summarize dcount(Product) by Computer
| summarize sum_dcount=sum(dcount_Product)

Its the only thing that displayed.

I want to continue and display all the results + the total in the same table/view.

 

ok, that second option I added is for that use case.

Just keep in mind, that you cannot really sum a dcount, unless you know that each row is actually is mutually exclusive.  If you can expand on your scenario there could be other options (for e.g. you may have to use dcount_hll and hll_merge