Forum Discussion
How can I select distinct values in a column rather than distinc column ?
- Nov 04, 2019
How about, either of these?
Perf | where CounterName =="% Used Space" | summarize AggregatedValue = count(CounterName) by bin(TimeGenerated, 10m), CounterName // shows unique ConunterValues per CounterName // source: https://docs.microsoft.com/en-us/azure/kusto/query/dcount-aggfunction Perf | where CounterName =="% Used Space" | summarize AggregatedValue = dcount(CounterValue) by bin(TimeGenerated, 10m), CounterName
How about, either of these?
Perf
| where CounterName =="% Used Space"
| summarize AggregatedValue = count(CounterName) by bin(TimeGenerated, 10m), CounterName
// shows unique ConunterValues per CounterName
// source: https://docs.microsoft.com/en-us/azure/kusto/query/dcount-aggfunction
Perf
| where CounterName =="% Used Space"
| summarize AggregatedValue = dcount(CounterValue) by bin(TimeGenerated, 10m), CounterName
- Gamleur84Nov 05, 2019Copper Contributor
CliveWatson Thanks Clive. I am not sure what is the most impressive. The fact that you understood my issue although my explanation was messy, incomplete and not well formatted or the accuracy of your answer.
The answer you provided works well for my case, I am keen to understand the explanation. Shall I use distinct when looking for distinct rows rather than values ?
I suspect the key is dcount(), i read about it but I was reluctant to use it because of this: returns an estimate for the number. The dcount() aggregation function is primarily useful for estimating the cardinality of huge sets. It trades performance for accuracy
In my case, the accuracy is important, but I am analyzing a small set...