Jan 17 2018
03:55 AM
- last edited on
Apr 07 2022
04:51 PM
by
TechCommunityAP
Jan 17 2018
03:55 AM
- last edited on
Apr 07 2022
04:51 PM
by
TechCommunityAP
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!
Jan 17 2018 11:13 AM - edited Jan 17 2018 11:13 AM
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
Jan 17 2018 11:27 PM
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.
Jan 18 2018 03:12 AM
ok, that second option I added is for that use case.
Jan 21 2018 01:57 PM
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 )