Mar 09 2021
04:01 PM
- last edited on
Apr 08 2022
10:45 AM
by
TechCommunityAP
Mar 09 2021
04:01 PM
- last edited on
Apr 08 2022
10:45 AM
by
TechCommunityAP
So I'm having a hard time coming up with a query that will get me the intended results. Any help would be appreciated.
My data looks like this:
Computer | ID |
SERVER-A | 12345 |
SERVER-A | |
SERVER-A | 67890 |
SERVER-B | |
SERVER-C | |
SERVER-C | 34567 |
What I'm trying to get in a result:
Expected Result:
Computer | ID |
SERVER-A | 12345 |
SERVER-A | 67890 |
SERVER-B | |
SERVER-C | 34567 |
I'm sure I'm missing something simple...
Mar 10 2021 01:28 AM
Solution@Scott Allison
I'm not sure if I missed the 'simple' as well, but this works, using the datatable!
datatable (Computer:string,ID:string)
[
'SERVER-A','12345',
'SERVER-A','',
'SERVER-A','67890',
'SERVER-B','',
'SERVER-C','',
'SERVER-C','34567'
]
| summarize countif(toreal(ID) > 1), make_set(Computer),make_set_if(ID, isnotempty(ID)) by Computer
| summarize by Computer, tostring(set_ID)
| extend set_ID = iif(set_ID == '[]',' ',set_ID)
| mv-expand ID=todynamic(set_ID) to typeof(string)
| project-away set_ID
Mar 10 2021 05:51 AM
Mar 10 2021 01:28 AM
Solution@Scott Allison
I'm not sure if I missed the 'simple' as well, but this works, using the datatable!
datatable (Computer:string,ID:string)
[
'SERVER-A','12345',
'SERVER-A','',
'SERVER-A','67890',
'SERVER-B','',
'SERVER-C','',
'SERVER-C','34567'
]
| summarize countif(toreal(ID) > 1), make_set(Computer),make_set_if(ID, isnotempty(ID)) by Computer
| summarize by Computer, tostring(set_ID)
| extend set_ID = iif(set_ID == '[]',' ',set_ID)
| mv-expand ID=todynamic(set_ID) to typeof(string)
| project-away set_ID