1
3

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.

PowerQuery で階層構造のヘッダーを持つテーブルをピボット解除 V1

Last updated at Posted at 2020-08-01

はじめに

階層構造のヘッダーを持つテーブルをピボット解除する方法です。この記事を描いた後にもう少しシンプルな方法を見つけたのですが試行錯誤の記録としてこの記事も残します

やりたいこと

ヘッダーがこんな感じで階層構造になっている表に出会いました。
image.png
Power Query を使ってこの表をピボット解除してこういう形に持っていきたいと思います
image.png

手順

スタートの状態

image.png

担当者ごとに「目標」の列と「実績」の列とをマージする

区切り記号はコロンにしました
image.png

フィル > 上で 空白を埋める

image.png

1行目をヘッダーにする

image.png

ピボット解除する

image.png

不要な行をフィルタで除外する

image.png

列を分割する

image.png

ヘッダー名を整理して氏名の後ろのコロンを置換で取り除いて完成

image.png

まとめ

列の結合 > ピボット解除 > 列の分割 という手順で階層構造のヘッダーを持つテーブルのピボット解除ができました!

1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?