Reputation: 6196
Say I have a table like this:
Computer | AppName | AppVersion |
---|---|---|
C1 | App1 | 1.0 |
C1 | App2 | 2.0 |
C2 | App1 | 3.0 |
C2 | App2 | 4.0 |
C3 | App1 | 5.0 |
C3 | App2 | 6.0 |
I'd like to transform it into a table like this:
Computer | App1 | App2 |
---|---|---|
C1 | 1.0 | 2.0 |
C2 | 3.0 | 4.0 |
C3 | 5.0 | 6.0 |
Is that possible in KQL?
Upvotes: 1
Views: 168
Reputation: 44971
pivot plugin
datatable(Computer:string, AppName:string, AppVersion:string)
[
,"C1" ,"App1" ,"1.0"
,"C1" ,"App2" ,"2.0"
,"C2" ,"App1" ,"3.0"
,"C2" ,"App2" ,"4.0"
,"C3" ,"App1" ,"5.0"
,"C3" ,"App2" ,"6.0"
]
| evaluate pivot(AppName, take_any(AppVersion))
Computer | App1 | App2 |
---|---|---|
C1 | 1.0 | 2.0 |
C2 | 3.0 | 4.0 |
C3 | 5.0 | 6.0 |
Upvotes: 1