> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/platform/ja/user-guide/software-metering/software-metering-nql-examples.md).

# ソフトウェアメータリングNQLの例

{% hint style="warning" %}
\nNexthink Infinity からユーザーやデバイスを削除することができます。 これが起こると、ソフトウェアメータリングデータが、関連付けられたユーザーやデバイスがない状態で残る場合があります。 インベントリオブジェクトのデータ保持に関する詳細については、\[データ保持と解像度のキーなデータプラットフォームコンセプトに関する理解] (<https://docs.nexthink.com/platform/ja/getting-started/understanding-key-data-platform-concepts/data-resolution-and-retention#dataresolutionandretention-retentionperdatacategory>) のドキュメントを参照してください。
{% endhint %}

## ソフトウェアメータリングデータをクエリする <a href="#softwaremeteringnqlexamples-queryingthesoftwaremeteringdata" id="softwaremeteringnqlexamples-queryingthesoftwaremeteringdata"></a>

ソフトウェアメータリングデータやその他の関連情報にアクセスするために、[調査](/platform/ja/user-guide/investigations.md) モジュールで Nexthink Query Language (NQL) を使用します。

## NQL データの構造 <a href="#softwaremeteringnqlexamples-nqldatastructure" id="softwaremeteringnqlexamples-nqldatastructure"></a>

`software_metering.events` テーブルにはソフトウェア利用データが含まれています。 各イベントの解像度は1週です。 このデータの保持期間は90日です。

## NQLにおけるソフトウェアメータリングと他のテーブル間の時間枠の整合性

NQLを使用してソフトウェアメータリングデータをクエリする際、これらのイベントが7日ごとにグループ化されることに注意してください。 これは、各イベントが1週間全日程にわたることを意味し、単日ではありません。 毎週の`software_metering.event`の開始は、常に月曜日の00:00 UTCです。

**なぜ重要か**

この週間のグループ化のために、**時間枠が一致しない**と以下を引き起こす可能性があります：

* データの欠落、
* 部分的な結果の含有、または
* 不正確な比較―特に、より細かい時間単位を使用する`execution.events`などのイベントと組み合わせる場合。

例えば、これら2つのクエリは、いずれも月曜日の00:00 UTCからデータ取得を開始するため、同じ結果を返します：

```nql
2025-08-04 00:00:00から2025-08-08 10:00:00までのsoftware_metering.events
| where application.name == "Firefox"
| summarize number_of_users = user.count()
```

```nql
2025-08-04 00:00:00から2025-08-08 10:00:00までのexecution.events
| where application.name == "Firefox"
| summarize number_of_users = user.count()
```

### NQL クエリの例 <a href="#softwaremeteringnqlexamples-examplesofnqlqueries" id="softwaremeteringnqlexamples-examplesofnqlqueries"></a>

<details>

<summary>直近90日のデスクトップベースのソフトウェアで2時間未満しか使用していないユーザーのリストを取得する。</summary>

{% code lineNumbers="true" %}

```
過去30日のユーザー\n| ソフトウェアメータリング.eventsを過去90日間内で使用中\n| メータ構成.nameが"*office*"である\n| デスクトップアプリケーション使用時間 = デスクトップフォーカス時間.sum() を計算する\n| デスクトップアプリケーション使用時間 <> NULL と デスクトップアプリケーション使用時間 < 2h である\n| user.name, デスクトップアプリケーション使用時間 をリスト化する
```

{% endcode %}

</details>

<details>

<summary>過去90日間アプリケーションパッケージがインストールされているが、アプリケーションの利用がないデバイスのリストを取得する。</summary>

{% code lineNumbers="true" %}

```
過去30日のデバイス\n| 90日間以内にソフトウェアメータリング.eventsを使用\n| メータ構成.nameが"visio"である\n| デスクトップアプリケーション使用時間 = デスクトップフォーカス時間.sum() を計算する\n| package.installed_packages を含む\n| Package.nameが"*visio*"である\n| パッケージタイプがプログラムである\n| packages_installed = device.count() を計算する\n| デスクトップアプリケーション使用時間 == NULL であり、 packages_installed > 0 である\n| device.name, デスクトップアプリケーション使用時間, packages_installed をリスト化する
```

{% endcode %}

</details>

<details>

<summary>ウェブ使用時間が有効でない場合: ウェブベースソフトウェアに少なくとも一度アクセスしたユーザーのリストを取得する。</summary>

{% code lineNumbers="true" %}

```
直近30日のユーザー\n| ソフトウェアメータリング.eventsを過去90日間内で使用中\n| メータ構成.nameが"*miro*"である\n| web_is_usedがTRUEである\n| event_where_web_was_used = count() を計算する\n| event_where_web_was_used > 0 である\n| users_using_application = count() を集計する
```

{% endcode %}

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexthink.com/platform/ja/user-guide/software-metering/software-metering-nql-examples.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
