Skip to main content

Posts

Perform Calculation On Multiple Values From Single Kusto Input

Let’s consider a scenario, wherein requirement is to find out the percentage of a particular type of values from the single input set. Below can be considered as an example of input sample data and need is to find out how much percentage of dev releases and how much percentage of prod releases are present in the input data. let demoData = datatable(Environment: string, Feature:string)   [   "dev" ,  "Feature1" ,   "test" ,  "Feature1" ,   "prod" ,  "Feature1" ,   "Dev" ,  "Feature2" ,   "test" ,  "Feature2" ,   "dev" ,  "Feature3" ,   "test" ,  "Feature3" ,   "prod" ,  "Feature3"    ];  Approach In order to achieve the solution, one has to go through various steps as mentioned below: Step 1: Get total number of records from input set let totalRecords = demoData |  count   | project TotalRecords =  Count ;   Step 2: Get

Working with Kusto Case Sensitivity

Like most of the other programming and query languages, Kusto too has sense of case sensitivity, which means, it can deal with upper-case and lower-case while performing comparisons between values. Let’s consider below sample data: let demoData = datatable(Environment: string, Feature:string)   [          "dev" ,  "Feature1" ,       "test" ,  "Feature1" ,       "prod" ,  "Feature1" ,       "Dev" ,  "Feature2" ,       "test" ,  "Feature2" ,       "dev" ,  "Feature3" ,       "test" ,  "Feature3" ,       "prod" ,  "Feature3"       ]; Case Sensitive Comparison The Case sensitive means match should be exact, upper-case letter must match with upper-case only and same for lower-case. Whenever the match is performed between an upper-case character and a lower-case character, query would return false, although both the characters a

Azure Data Explorer - Kusto Query - Transform Rows To Columns

In my previous post, I discussed about getting the result set which lies between the given date range. This time, let’s take an another interesting example, wherein we need to transform the number to rows into number of columns as our result set. Consider below data for which we need to write query: let demoData = datatable(Environment: string, Feature:string, Location:string, Version: string)     [          "dev" ,  "Feature1" ,  "Site1" ,  "v1" ,          "test" ,  "Feature1" ,  "Site2" ,  "v2" ,          "prod" ,  "Feature1" ,  "Site3" ,  "v3" ,         "dev" ,  "Feature2" ,  "Site1" ,  "v4" ,          "test" ,  "Feature2" ,  "Site4" ,  "v5" ,          "dev" ,  "Feature3" ,  "Site1" ,  "v6" ,          "test" ,  "Feature3" ,