Solution
You've been asked to write a query that answers the following question:
What was the total week-by-week damage caused by all flood events? Show damage in the unit of Euros. In this case, damage refers to both property and crop damage. Assume the Euro is worth 1.14 USD.
This solution provides one possible way to construct a query that answers the previous question.
Solution process
- Set the conversion rate using the
let
statement. - Filter out as much information as possible.
- The EventType should have the term "flood"
- Create a column that sums damage from DamageProperty and DamageCrops to give a value of damage in USD. Divide this value column by the conversion rate set in Step 1 to obtain damage in Euros.
- Summarize the sum of the new damage column by a seven day bin.
- Render the results as a column chart.
Solution query
The previous steps are all included in the following query:
let Eur = 1.14; // conversion rate
StormEvents
| where EventType has "flood"
| extend Damage = (DamageProperty + DamageCrops) / Eur
| summarize sum(Damage) by bin(StartTime, 7d)
| render columnchart
Your results should look something like the following image:
Insights
From the results, we can see that floods caused financial damage mainly during the spring and summer months. There were several spikes of damage, reaching at most around 750 million Euro of damage.