How to Use Min and Max Function in Kusto Query | Kusto Query Language Tutorial (KQL)

Topic: How to Use Min and Max Function in Kusto Query 


In this article we are going to learn about min and max functions in Kusto Query Language min and max functions are used to find the minimum values and maximum values Kusto Query Language is a powerful tool to explore your data and discover patterns, identify anomalies and outliers, create statistical modeling, and more. The query uses schema entities that are organized in a hierarchy similar to SQL's: databases, tables, and columns.

 // min and minif - Returns the minimum value across the group for which Predicate evaluates to true.  
 //create Table and Insert Sample Data in Azure Data Explorer DB for Testing  
 .drop table TotalSale  
 .create table TotalSale (  
   id: int   
   ,SalePersonFName: string  
   ,SalePersonLName : string  
   ,ProductName : string  
   ,ItemsSold : int  
   ,SoldPrice :real  
   ,SoldDate: date  
   ,City : string  
   ,State : string  
   ,Country : string  
   ,Region : string  
   )  
        
      //Insert data  
       .ingest inline into table TotalSale <|  
 11,Tamara,Tony,Cell Phone,2,1200,2015-03-03,Frankfurt,Hesse,Germany,Europe  
 9,Petra,Henry,TV,10,5000,2015-04-08,Paris,Île-de-France,France,Europe  
 3,Christy,Ladson,TV,3,1600,2015-04-02,High Point,NC,USA,North America  
 7,Chirag,Patel,Cell Phone,5,1500,2015-06-23,AhmadAbad,Gujrat,India,Asia  
 2,M,Raza,Cell Phone,2,800,2015-07-15,Charlotte,NC,USA,North America  
 5,Najaf,Ali,Computer,1,300,2015-06-20,Karachi,Sindh,Pakistan,Asia  
 6,Sukhjeet,Singh,TV,2,900,2015-06-21,ChandiGar,Punjab,India,Asia  
 4,John,Rivers,Laptop,5,2400,2014-03-09,Jersey City,NJ,USA,North America  
 8,Aleena,Aman,Laptop,2,800,2015-05-25,Lahore,Punjab,Pakistan,Asia  
 10,Rita,Roger,Laptop,7,2100,2015-04-11,Paris,Île-de-France,France,Europe  
 1,Aamir,Shahzad,TV,1,700,2015-07-15,Charlotte,NC,USA,North America  
 12,aamir,Shahzad,TV,1,7000,2015-07-15,Charlotte,NC,USA,North America  
 10,Rita,Roger,Laptop,7,2100,2015-04-11,Paris,Île-de-France,France,Europe  
   
   
 //Get the Max value across table  
 TotalSale  
 | summarize min(SoldPrice)  
   
 // get max value for each Region  
 TotalSale  
 | summarize min(SoldPrice) by Region  
   
 //using max by using Region by using maxif  
 TotalSale  
 | summarize minif(SoldPrice,Region=="Asia")  
   
 TotalSale  
 | summarize minif(SoldPrice,ItemsSold>3)  

Video Demo: How to Use Min and Max Function in Kusto Query | Kusto Query Language Tutorial (KQL)

3 comments:

  1. A friend of mine recommended brillianthackers800@gmail.com to me although i was feeling skeptical about them at first but i went ahead to message them and they helped me settle bank loans and they also helped me increase my credit score you can chat them on WhatsApp +14106350697

    They will surely help you with your hacking problems at a very affordable price and they are very reliable and they deliver a perfect job

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. I couldn’t bear the pain of losing all my money to a fake cryptocurrency platform because I had been taken for a fool who trusted the wrong people. I went to the authorities but there was nothing they could do to get back my money from this cryptocurrency platform until my friend told me about Spyweb Cyber Security Service, after my research about Spyweb Cyber Security, I found them to be the most reliable and trustworthy crypto recovery service out there. I provided all the information of my scam to Spyweb Cyber Security Services and my money was recovered within 72 hours. I’m truly grateful for their top-notch service and Spyweb Cyber Security is indeed the best and most reliable cryptocurrency recovery company. I would suggest you contact them if you wish to recover your cryptocurrency.

    E-Mail: SPYWEB @ CYBERDUDE. COM
    Whats App Contact: +1 323 904 8824

    ReplyDelete