3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Power BI Desktopでグループごとに連番。使ったデータは「Netflix 2022 Quarterly Earnings」

Posted at

インポート

Netflixは、2022年4月10日、2022年第一四半期の業績を発表しました。
約10年ぶりに加入者が減少に転じ、話題となっています。
その業績データを「Power BI Desktop」に取り込みました。
その際、グループ(エリア)ごとの収支項目に連番を付けるのに手こずったので、その部分をメモしておきます。

データはNetflixのIRサイトから取得しました。

Power BI Desktopにインポートします。

image.png

データ概観

なお、データのExcelで開くと以下のようになります。

image.png

以下のエリアごとに分かれ、各エリアごとに

United States and Canada (UCAN)
Europe, Middle East and Africa (EMEA)
Latin America (LATAM)
Asia-Pacific (APAC)

以下の収支項目が並んでいます。
下記項目に、エリアが変わったら1から始まるように番を振りたかったのです。

Revenues
Paid net membership additions (losses)
Paid memberships at end of period
Average paying memberships
Average revenue per membership (2)
% change as compared to prior-year period
Constant currency % change as compared to prior-year period*

Power BI Desktopで取り込んだ直後の状態です。

image.png

「グループ化」で準備

データの加工を進め下記の体裁にし、

image.png

「グループ化」を実行します。

image.png

処理後こうなります。

image.png

「カスタム列」で連番

次に、「カスタム列」を用い、各Tableの中のデータに対し連番を振ります。

image.png

使用した関数が「Table.AddIndexColumn」です。
「Tabel名(テーブルを含む列名)、「カスタム列名」、「開始番号」、「増分」と設定します。

Table.AddIndexColumn([連番繰り返し],"連番",1,1)

実行した結果です。
Tableの中で連番が振られました。

image.png

Table列を展開することで、

image.png

エディター画面にTableの中の列が追加されます。

image.png

グラフ

上記加工データをもとに、グラフを作成しました。
(今回はx軸が時間軸順に並べるところまで設定していません。文字型と認識されているからです。これは後ほど加工予定です)

image.png

会員数減がわかるグラフも作成しました(右上)。

image.png

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?