4
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 Service で レポートをコピーしたい。ただし、レポートに紐づくデータセットも変更するのだ。

Last updated at Posted at 2021-07-05

ちまちまとビジュアルごとに設定するのは面倒だし(テーマを使いたい)のと Power BI Desktop を使わなければならないというのは面倒だ(Power BI service だけで完結したい)。

Power BI dataset および Power BI report を Power BI service に展開するには Power BI Desktop が必須ということではないから、できる手段は整えておきたいよね。 Power BI report を追加するだけのために Power BI Desktop を準備する必要はないのだ。多くの場合で、Power BI Desktop を用いたレポートの作成になるのでよいのだけど。

Themes can only be applied when using Power BI Desktop. You cannot apply themes to existing reports within the Power BI service.

レポートのテーマ適用は Power BI Desktop でやってねということだ。

  • 仕方がない(終了)
  • 代替案を考える(👈いまここ)

テンプレートになるレポートを用意しておく

テンプレートになるレポートを Power BI service に用意しておく。このレポートを共有することはあまりないから、マイワークスペースにでもおいておこうか。
あらかじめレポートのテーマを適用しておけばよいし、利用するデータモデルがわかっているのであれば、ビジュアルを配置しておいてもよいよね。

ここは Power BI Desktop を使うしかない。テンプレートを追加していくには、テンプレートのデータセットにライブ接続するレポートを作ればよい。で、ワークスペース(ここでは マイワークスペース)にデプロイしておく。するとこうなる。
image.png

レポートをコピーする

Power BI service 上でも レポートをコピーできるけれども、紐づくデータセットを変更する機能がない。とはいえ、Power BI Rest API にはそれがある。なのでこれを使う。

で、PowerShell で十分でしょ。

Login-PowerBI | Out-Null

$NewReportName = 'NewReportWithInovation'
$TempleteReportName = 'Inovation'
$TargetWorkspaceName = 'Rogue team'
$TargetDatasetName = 'NorthwindJ'

$TempleteReport = Get-PowerBIReport -Name $TempleteReportName
$TargetWorkspace = Get-PowerBIWorkspace -Name $TargetWorkspaceName
$TargetDataset = Get-PowerBIDataset `
    -Workspace $TargetWorkspace `
    -Name $TargetDatasetName

Copy-PowerBIReport `
    -Name $NewReportName `
    -Report $TempleteReport `
    -Workspace $TargetWorkspace `
    -TargetDatasetId ($TargetDataset.Id)

コピーしたレポートを更新するなど

あとはお好みで

思ったこと🙄

できないことはできるようにしてしまえばよい。多くの場合で手段はすでに用意されている。
OneDrive for Business でテンプレートレポートを管理してもよいかなと。

その他

4
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
4
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?