Hi,
There is no particular function for loop. I would guess the thing that you want to achieve is something like:
Perf
| where ObjectName == "LogicalDisk"
| where CounterName == "Disk Read Bytes/sec"
| where InstanceName == "C:"
| where _ResourceId == "/subscriptions/ebb79bc0-aa86-44a7-8111-cabbe0c43993/resourcegroups/ch1-fabrikamrg/providers/microsoft.compute/virtualmachines/ch1-retailvm01"
| serialize
| extend someValue = prev(TimeGenerated, 1) - TimeGenerated
You can check the query against the public Log Analytics demo env.
result looks like this
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.