Forum Discussion
tipper1510
Dec 18, 2023Brass Contributor
Use of TimeRange parameter in workbooks
Hi,
I use the timerange parameter as:
| where Timestamp >= {TimeRange:start} and TimeGenerated <= {TimeRange:end}
but need to incorporate into:
| where Timestamp between ( startofday(ago(14d)) .. endofday(ago(7d)) )
Any tips please...
Regards,
Tim
- Clive_WatsonBronze ContributorHi Tim, I dont fully understand your question, are you trying to pass 14d and 7d into the syntax as a parameter. Usually you'd just use the {TimeRange:start} etc like you've shown.
Or do you mean:
| where Timestamp between ( startofday({TimeRange:start}) .. endofday({TimeRange:end}) )- tipper1510Brass ContributorHi Clive,
I need to use the TimeRange parameter with the 14d ago and 7ago as need to get the previous weeks data for comparison but ensure I use the supplied initial TimeRange.
Regards,
Tim- Clive_WatsonBronze Contributor
Is this the type of result (using the Microsoft demo data), very simplified.
Go to Log Analytics and run query// arg0let last30days=Heartbeat| where TimeGenerated between( ago(30d) .. now() )| summarize //min(TimeGenerated), max(TimeGenerated)count()by bin(TimeGenerated,1d);//arg1let last7days=Heartbeat| where TimeGenerated between( ago(14d) .. ago(7d) )| summarize //min(TimeGenerated), max(TimeGenerated)count()by bin(TimeGenerated,1d);union withsource=sourceTable last30days, last7days| render columnchart