How to Use iif for IF ELSE in Kusto Query | Kusto Query Language Tutorial (KQL)

Topic: How to use iif for IF ELSE in Kusto Query Language.

In this article we are going to learn about iif statement term this can be used so for if else the condition is true or false so there are only two possibilities here so it is very useful and a quick way to write the expressions of where we would like to use the if else condition.

 

 //iif - It can be use for IF-ELSE , The condition is true or false.  
   
   
 //Let's create a table Customer  
 //.drop table Customer  
 .create table Customer (CustomerId: long, FName: string,LName:string, Salary: int)   
  .ingest inline into table Customer <|  
 1,Aamir,Shahzad,2000  
 2,Raza,ALI,4000  
 3,Lisa,Rivers,50000  
 4,steve,Ladson,1000  
 5,Robert,Jr,500  
 6,aamir,ali,  
   
   
 Customer  
 | extend SalaryType=iif(Salary<=4000 ,"Very Low Salary" ,"Good Salary")  
   
 //Taking care of Null/Blanks  
 Customer  
 | extend SalaryType=iif(Salary<=4000 or isnull(Salary) ,"Very Low Salary" ,"Good Salary")  
   

Video Demo: How to use iif for IF ELSE in Kusto Query | Kusto Query Language Tutorial (KQL)

No comments:

Post a Comment