Azure Data Explorer - Perform Calculation On Multiple Values From Single Kusto Input

Let’s consider a scenario, wherein the requirement is to find out the percentage of a particular type of values from a single input set.

Below can be considered as an example of input sample data and we need to find out what percentage of dev releases and what 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" 


In order to achieve the solution, one has to go through various steps as mentioned below,

Step 1

Get the total number of records from the set.

let totalRecords = demoData
| count 
| project TotalRecords = Count;  

Step 2

Get only those records which are of type ‘dev’

let devRecords = demoData
| where Environment =~ "dev" 
| count 
| project TotalDevRecords = Count;  

Step 3