Hello @Romain Miralles ,
Welcome to the Microsoft Q&A platform.
You can't pass a value dynamically, so the best way to achieve what you want is to write the function this way:
let SummarizeByCity = Table | where param == "City" | ... | summarize count() by city;
let SummarizeByCountry = Table | where param == "Country" | ... | summarize count() by country;
union SummarizeByCity, SummarizeByCountry
Note: This will be optimal performance-wise, as Kusto will only evaluate the relevant branch (City OR Country, but not both), because of the where clauses.
For more detail, refer aggregation functions - count() and dcount().
Hope this helps. Do let us know if you any further queries.
------------
- Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
- Want a reminder to come back and check responses? Here is how to subscribe to a notification.