Kusto Lightning Fact 3: .create function
- azurecoder
- Jul 13, 2020
- 1 min read
In the previous lightning fact we looked at using variables through the let command. In this tutorial we'll look at using functions which give us a a bunch of reusability.
.create function ifnotexists
with (docstring = 'A simple function to get aggregates of countries', folder='CountryFunctions')
AllCountrySummaryState() {
sales
| project Country, Profit = Total_Profit / 1000000, Earnings = Total_Revenue / 1000000, Year = getyear(Order_Date)
| summarize Earnings = round(sum(Earnings)), Profit = round(sum(Profit)), TransactionCountPerYear = count() by Country, Year
| order by Country, Year asc
| extend EarningsRatio = round((Profit / Earnings) * 100, 2)
}
This will create a function if it doesn't already exist with a description and putting it into a folder called CountryFunctions.
There's a few interesting caveats in this function. We get profit, earnings per country per year + the number of transactions in each year. From this we can create an earnings ratio to see how much variance there has been over the years in earnings per country.
You can also use .drop function to drop the function as you would expect.
A feature here is also the keyword extend which allows you to add to the project query without projecting out everything else again.
Brand: Patek PhilippeModel: World TimeReference Number: 5231JDiameter: 38.5mmThickness: 10.23mmCase Material: Yellow goldDial Color: Cloisonné Enamel Indexes: link Applied gold dots at link 3, 6, 9, and link 12Lume: NoneWater Resistance: N/AStrap/Bracelet: Alligator strap
But link for the rest of us – me included – the Oris Aquis Caliber 400 is a legit competitor hidden in plain sight. It works as link a one-watch collection for someone who wants a terrific timepiece and isn’t impressed by brand prestige – and it works as a link tenth watch for someone who already has the big brands covered and wants to explore the indies. It's not cheap, but it is a steal. And you can have one on your wrist today.
Finally – and apart from the SKX of it all – the specs are solid, the link pricing makes sense, and it's a size that will attract a wide variety of owners to the brand (both seasoned and new). As a fan of easy-wearing Seikos and Seiko 5's history of smaller sports watches, I think this is a substantial development link for the modern Seiko 5 lineup that link should only succeed in expanding Seiko's scope at this price point. Nicely done.
Before we dive into the interview (sorry, had to), Jason and James chat about link Jason's first link time watching Predator, one of James' most Vancouver-themed watches, watch-themed t-shirts, and the mechanical problem that saw Jason's classic Land Rover taking a link trailer to the shop.