# DEXスコアのNQLサンプル

Nexthink Query Language (NQL) を使用して、DEXスコアデータおよび関連情報にアクセスします。

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

`dex.scores`および`dex.application_scores`テーブルにはスコアデータが含まれています。 システムは、毎日00:00 UTCに、`user`および`device`オブジェクトの組み合わせ、そして過去7日間にアクティブだった`device`次元のスコアを計算します。 例えば、過去7日間にデバイス1とデバイス2を使用した従業員Aには、その日用の2つのスコアデータセットが生成されます。

DEXスコアV3は、以前のバージョンとは異なり、デバイス中心のアプローチではなく、ユーザー中心のエクスペリエンス管理に主眼を置いています。 `device`テーブルでNQLクエリーを開始することは技術的には可能ですが、デバイスのメートルック値とそのスコアの間には乖離が生じる可能性があります。 より詳細な情報については、[DEXスコアの計算](https://edocs.nexthink.com/nexthink-infinity/infinity-specifications/digital-employee-experience-dex-specifications/computation-of-the-dex-score) (Nexthink Community ユーザーが利用可能) のFAQセクションを参照してください。

## dex.scoresテーブル <a href="#dexscorenqlexamples-dex.scorestable" id="dexscorenqlexamples-dex.scorestable"></a>

`dex.scores`テーブルには、エンドポイントとコラボレーションスコア及びそのサブスコアのデータが含まれています。 システムはスコア一式を次のように構成します。

各DEXスコアのノードには、`[node name]_value`という構文でスコア値が付与されています。 例えば、ログオン速度のスコアを取得したい場合、`score.endpoint.logon_speed_value`と入力します。

さらに、各ノードには`[node name]_score_impact`という構文でスコア影響値が付与されています。 この値は、このノードで監視される問題により、DEXスコアの技術コンポーネントが推定でどれくらい減少するかを示しています。

## dex.application\_scoresテーブル <a href="#dexscorenqlexamples-dex.application_scorestable" id="dexscorenqlexamples-dex.application_scorestable"></a>

`dex.application_scores`テーブルには、アプリケーションスコア及びそのサブスコアのデータが含まれています。 このテーブルは`users`、`devices`、および`application`オブジェクトとリンクされています。 システムはスコア一式を次のように構成します。

* `node.type`はアプリケーションスコア構造のノードのタイプを表します。
  * `page_loads`
  * `transactions`
  * `web_reliability`
  * `crashes`
  * `freezes`
  * `application`
* `node.value`はアプリケーションスコア構造のノードのスコアを示します。 対象のノードスコアを指定するには、`application_score.node.type`フィールドと一緒に使用する必要があります。
* `node.score_impact`は、このノードで監視される問題により、DEXスコアの技術コンポーネントが推定でどれくらい減少するかを示します。 対象のスコア影響を指定するには、`application_score.node.type`フィールドと一緒に使用する必要があります。

すべてのノードとそれぞれのNQL名については、[ハードメトリクスとそのデフォルトしきい値リスト](https://edocs.nexthink.com/nexthink-infinity/infinity-specifications/digital-employee-experience-dex-specifications/list-of-hard-metrics-and-thresholds) ドキュメント (Nexthink Community ユーザーが利用可能) を参照してください。

## score\_impact値 <a href="#dexscorenqlexamples-score_impactvalues" id="dexscorenqlexamples-score_impactvalues"></a>

`dex.scores`と`dex.application_scores`の両方で、すべてのノードに`score_impact`値が含まれます。すなわち、`[node name]_score_impact`です。 この値は、ノードにおけるユーザーレベルの問題により、DEXスコアから削除されるポイント数を推定したものです。 例えば、`logon_speed_score_impact`は、遅いログオンによりユーザーのDEXスコアに与える推定影響を含みます。

人口に対するノードのDEXスコアへの**影響を計算する**には、以下の式を使用します。

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-870af697d34764e214246a580200a7cda24722b8%2Fimage-2024-03-18-09-22-56-620.png?alt=media" alt="image-2024-03-18-09-22-56-620.png" width="760"><figcaption></figcaption></figure>

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

<details>

<summary>会社の最新の総合DEXスコアを取得します。</summary>

{% code lineNumbers="true" %}

```
users
| include dex.scores during past 24h
| compute DEX_score_per_user = value.avg(), c1 = count()
| where c1 > 0
| summarize Overall_DEX_score =  DEX_score_per_user.avg()
```

{% endcode %}

</details>

<details>

<summary>スイスの従業員に対する最新の仮想セッション遅延スコア値を取得します。</summary>

{% code lineNumbers="true" %}

```
users
| include dex.scores during past 24h
| where context.location.country == "Switzerland"
| compute Virtualization_score = endpoint.virtual_session_lag_value.avg(), c1 = count()
| where c1 > 0
| summarize Overall_virtualization_score = Virtualization_score.avg()
```

{% endcode %}

</details>

<details>

<summary>オペレーティングシステム プラットフォームごとにDEXスコア値を比較します。</summary>

{% code lineNumbers="true" %}

```
devices
| include dex.scores during past 24h
| compute DEX_score_per_device = value.avg(), c1 = count()
| where c1 > 0
| summarize Overall_DEX_score_per_OS_platform = DEX_score_per_device.avg() by operating_system.platform
```

{% endcode %}

</details>

<details>

<summary>アプリケーションスコアと該当するページロードスコアを取得します。</summary>

{% code lineNumbers="true" %}

```
users 
| include dex.application_scores during past 24h 
| where application.name == "miro" and node.type == application 
| compute application_score_per_user = value.avg()
| include dex.application_scores during past 24h 
| where application.name == "miro" and node.type == page_loads 
| compute page_load_score_per_user = value.avg()
| summarize Overall_application_score = application_score_per_user.avg(), Overall_page_load_score = page_load_score_per_user.avg() 
```

{% endcode %}

</details>

<details>

<summary>劣悪なデジタルエクスペリエンスに苦しむ上位50人のユーザーを特定します。</summary>

{% code lineNumbers="true" %}

```
users
| with dex.scores during past 24h
| compute DEX_score = score.value.avg()
| list name, DEX_score
| sort DEX_score asc
| limit 50
```

{% endcode %}

</details>

<details>

<summary>ログオンスコアの技術スコアへの推定影響を取得します。</summary>

{% code lineNumbers="true" %}

```
users
| include dex.scores during past 24h
| compute logon_speed_score_impact_per_user = endpoint.logon_speed_score_impact.avg(), dex_score_per_user = dex.score.value.avg()
| summarize Impact_of_logon_speed_on_technology_score = (logon_speed_score_impact_per_user.avg()*countif(logon_speed_score_impact_per_user != NULL))/countif(dex_score_per_user != NULL)
```

{% endcode %}

</details>

<details>

<summary>ログオンスコアがすべての人口に与えるDEXスコアへの影響を計算します。</summary>

{% code lineNumbers="true" %}

```
users
| include dex.scores during past 24h
| compute logon_speed_score_impact_per_user = endpoint.logon_speed_score_impact.avg(), DEX_score_per_user = value.avg()
| where DEX_score_per_user != NULL
| summarize total_logon_speed_score_impact = logon_speed_score_impact_per_user.avg()*countif(logon_speed_score_impact_per_user != NULL)/count()
```

{% endcode %}

</details>

## 考慮事項 <a href="#dexscorenqlexamples-considerations" id="dexscorenqlexamples-considerations"></a>

### dex.scoreテーブルに関連付けられた期間 <a href="#dexscorenqlexamples-timeframeassociatedwiththedex.scoretable" id="dexscorenqlexamples-timeframeassociatedwiththedex.scoretable"></a>

* 過去7日間にデータがない`user`または`device`オブジェクトにはスコアがありません。
* 今日の00:00 UTCに計算されたスコアは今日の日付に関連付けられており、昨日の日付ではありません。

このことは、`dex.scores`データを`during past 7d`とクエリするのは正しくないことを意味します。これは7日間のデータポイントを返し、各データポイントはすでに7日のローリングウィンドウだからです。 データは1日のみクエリされるべきです。例としては

* `dex.scores during past 24h`
* `dex.scores on 2023-10-30`

**例:**

{% code lineNumbers="true" %}

```
users
| include dex.scores during past 24h
| compute software_reliability_score_per_user = endpoint.software_reliability_value.avg()
```

{% endcode %}

スコアの毎日の計算は00:00 UTCに開始されますが、完了するまでに数時間かかる場合があります。 計算が終了すると、Nexthinkは結果に04:00 UTCのタグを付けます。

### 生のデータテーブルに関連付けられた期間 <a href="#dexscorenqlexamples-timeframeassociatedwithrawdatatables" id="dexscorenqlexamples-timeframeassociatedwithrawdatatables"></a>

生のメトリックテーブル、例えば`session.logins`、`web.page_views`を対応するスコアと比較するには、期間がDEXスコア計算時に使用されたものと一致する必要があります。

`00:00 UTC today - 7d to 00:00 UTC today`

お使いのブラウザのタイムゾーンと期間が一致していることを確認してください。

**例:**

* お使いのブラウザのタイムゾーンはCET（つまり、UTC + 1）です。
* 2024-01-17のDEXスコアと生のメトリクスを比較したい。
* Outlookのページロードトレンドを調べることに興味があります。

{% code lineNumbers="true" %}

```
web.page_views from 2024-01-10 01:00:00 to 2024-01-17 01:00:00
| where application.name == "outlook" and user.name == "TBD"
| summarize average_page_load_per_hour = page_load_time.overall.avg() by 1h
```

{% endcode %}

### 1時間ごとのサンプル <a href="#dexscorenqlexamples-hourlysamples" id="dexscorenqlexamples-hourlysamples"></a>

DEXスコアは1時間ごとのデータサンプルを考慮しています。 このデータは、フィールドの平均または過去1時間のイベントの合計となることがありますが、これはメトリックの種類によります。 設定されたスコアのしきい値を超えたかどうかを理解するには、1時間単位の集計を使用し、5分または15分のタイムバケットを使用しないでください。

**例:**

{% code lineNumbers="true" %}

```
Session.logins from 2024-01-10 01:00:00 to 2024-01-17 01:00:00
| summarize average_logon_time = time_until_desktop_is_visible.avg() by 1h
```

{% endcode %}

### 人口に対するDEXスコアの計算 <a href="#dexscorenqlexamples-computingdexscoresforpopulations" id="dexscorenqlexamples-computingdexscoresforpopulations"></a>

人口のDEXスコアを計算するには、まず各従業員のスコアを計算し、それを人口全体で平均する必要があります。

まず、`user`または`device`ごとのDEXスコアを集計し、その後人口に対して集計します。

この場合、NQLクエリを`dex.scores during past 24h`ではなく、個別のスコアを計算するために`users`または`devices`テーブルから始めるべきです。 `summarize`ステートメントを使用して人口に対するDEXスコアを計算します。

**例:**

{% code lineNumbers="true" %}

```
users
| include dex.scores during past 24h
| compute dex_score_per_user = value.avg()
| summarize dex_score = dex_score_per_user.avg()
```

{% endcode %}

### ユーザー、デバイス、およびデバイスの次元の適切な組み合わせを見る <a href="#dexscorenqlexamples-lookingattherightcombinationofuser-device-anddevicedimensions" id="dexscorenqlexamples-lookingattherightcombinationofuser-device-anddevicedimensions"></a>

システムはユーザー、デバイス、およびジオロケーションやロケーションタイプといったデバイスの次元の組み合わせに対してスコアを計算します。 このアプローチの背後にある理論は、各従業員のコンテキストにおける高度なフィルタリングを可能にし、洞察を引き出すことです。

これにより、過去7日間でロケーションを変更した従業員は、異なるジオロケーションやロケーションタイプに対して複数のスコアを持つことになります。 さらに、複数の従業員が使用するデバイスも、複数のスコアを持ちます。

生のメトリックとその対応するスコアを比較するには以下を行う必要があります。

1. スコアデータに関連付けられた異なる次元を理解する。
2. 生データを見る際に同じ次元を適用する。

**例:**

{% code lineNumbers="true" %}

```
device_performance.boots from 2024-01-31 01:00:00 to 2024-02-06 01:00:00
| where device.name == "TBD" and context.location.type == "Remote" and context.location.state == "Vaud"
| summarize average_boot_duration_per_hour = duration.avg() by 1h
```

{% endcode %}

### 従業員と関連付けられていないデバイスのイベント <a href="#dexscorenqlexamples-deviceeventswithoutanemployeeassociatedwiththedevice" id="dexscorenqlexamples-deviceeventswithoutanemployeeassociatedwiththedevice"></a>

DEXスコア計算に使用されるメトリックの一部は、Nexthinkデータモデルにおいて`user`の関連付けがありません。例えば、

* `device_performance.events`
* `device_performance.boots`
* `device_performance.hard_resets`
* `device_performance.system_crashes`
* `connectivity.events`

DEXスコアパイプラインは、これらのイベントをこれらのユーザーのDEXスコアに関連付けるために、デバイス上の最近のユーザーのリストを保持します。 デバイスで最近のユーザーが見つからない場合、これらのイベントはデバイスのDEXスコアに加味されません。
