# count, countif

### count

```
IntuneDevices
| where TimeGenerated > ago (30d)
        and isnotempty(OS)
| summarize arg_max(TimeGenerated, *) by SerialNumber
| summarize count() by OS, SkuFamily, JoinType
```

<figure><img src="https://3533425259-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbx8yn20QqNJtsVaH9CY7%2Fuploads%2FWWgbCZRUHJpGKaoziGsW%2Fimage.png?alt=media&#x26;token=8321f8de-11df-4f54-998d-64daa05e4ee9" alt=""><figcaption></figcaption></figure>

### count

```
IntuneDevices
| where TimeGenerated > ago (30d)
        and isnotempty(OS)
| summarize arg_max(TimeGenerated, *) by SerialNumber
| summarize Count = count()
```

<figure><img src="https://3533425259-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbx8yn20QqNJtsVaH9CY7%2Fuploads%2FDOV2SXTVhqkVvGWDRr5t%2Fimage.png?alt=media&#x26;token=587736ef-e1a8-4c2e-8530-8eaf52ecbe19" alt=""><figcaption></figcaption></figure>

### countif

```
IntuneDevices
| where TimeGenerated > ago (30d)
        and isnotempty(OS)
| summarize arg_max(TimeGenerated, *) by SerialNumber
| summarize Count = countif(OS != 'Windows')
```

<figure><img src="https://3533425259-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbx8yn20QqNJtsVaH9CY7%2Fuploads%2FEQzQdNDLCJqudQDQlXEY%2Fimage.png?alt=media&#x26;token=fb0a2e9b-79ee-46cb-976a-0982f3287fc8" alt=""><figcaption></figcaption></figure>
