azure - Kusto pivot table aggregation - Stack Overflow

I need help with Kusto pivot table aggregation:I created pivot table overview with count of errors per

I need help with Kusto pivot table aggregation: I created pivot table overview with count of errors per system in last x days - example output:

|Error|System|Day-1|Day-2|Day-3
|Err1|System1|0|0|1
|Err1|System2|0|1|0
|Err2|System3|1|0|0

I need to aggregate output data by Error data column - that means Systems data should concatenate into single cell per unique error. Previous example would look like this:

|Error|System|Day-1|Day-2|Day-3
|Err1|System1,System2|0|1|1
|Err2|System3|1|0|0

My Kusto code looks like this:

<data processing>
| evaluate pivot(day, count(Error), Error)

I was not able to find a solution. Any suggestions? Thank you.

I need help with Kusto pivot table aggregation: I created pivot table overview with count of errors per system in last x days - example output:

|Error|System|Day-1|Day-2|Day-3
|Err1|System1|0|0|1
|Err1|System2|0|1|0
|Err2|System3|1|0|0

I need to aggregate output data by Error data column - that means Systems data should concatenate into single cell per unique error. Previous example would look like this:

|Error|System|Day-1|Day-2|Day-3
|Err1|System1,System2|0|1|1
|Err2|System3|1|0|0

My Kusto code looks like this:

<data processing>
| evaluate pivot(day, count(Error), Error)

I was not able to find a solution. Any suggestions? Thank you.

Share Improve this question edited Jan 30 at 7:50 Jahnavi 8,2311 gold badge6 silver badges13 bronze badges Recognized by Microsoft Azure Collective asked Jan 29 at 11:23 person.483person.483 212 bronze badges 1
  • Where are you running this query? – RithwikBojja Commented Jan 30 at 3:31
Add a comment  | 

1 Answer 1

Reset to default 0

Need to aggregate output data by Error data column - that means Systems data should concatenate into single cell per unique error:

To aggregate the data by error column and concatenate all the system data into single cell per unique error you can use the below approach as explained.

Here, I have used two Kusto functions to achieve the results which are strcat_array() and make_set().

strcat_array():

Creates a concatenated string of array values using a specified delimiter.

In the below query, it converts the system array into a comma-separated (,) string to show the system names in a single cell.

make_set():

Once the strcat_array applied to the query, now make_set functionality is to get all the unique system names for each error type in an array as shown in the below output.

let datasample = datatable(Error:string, System:string, ["Day-1"]:int, ["Day-2"]:int, ["Day-3"]:int)
[
    "Error1", "System1", 0, 0, 1,
    "Error1", "System2", 0, 1, 0,
    "Error2", "System3", 1, 0, 0
];
datasample
| summarize
    System = strcat_array(make_set(System),","), ["Day-1"] = sum(["Day-1"]), ["Day-2"] = sum(["Day-2"]),["Day-3"] = sum(["Day-3"])
    by Error

Output:

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745302316a4621510.html

相关推荐

  • azure - Kusto pivot table aggregation - Stack Overflow

    I need help with Kusto pivot table aggregation:I created pivot table overview with count of errors per

    11小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信