0
0

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 1 year has passed since last update.

Tableauの散布図の0の位置を常に固定する

Posted at

課題

Untitled (4).png
通常負の値をとる散布図はそれぞれのとる値によって列・行の各軸の表示領域の最大・最小が変わるため、それに伴ってゼロの位置が変わってしまい、フィルターを変更するたびに目線が変わってしまい分析の妨げになる恐れがある。

0を中央に固定する方法を考える。

使用する技術

軸の範囲を「自動」に設定しているとき、リファレンスラインをそのグラフのマークの値を超えた値で設定すると、ビューの表示範囲はそのリファレンスラインに合わせて広がる。

Untitled (5).png
Untitled (6).png

さらに、リファレンスラインの設定で「線」を「なし」に設定することで、何も表示させずに表示領域を自動的に拡張することが可能。
Untitled (7).png
Untitled (8).png

この仕組みを上下両方に設定します。

手順

計算フィールド「表示範囲」を作成。この計算により、正の値、負の値どちらを基準に領域を設定するかを状況に応じて変更できるようにする。

IF ABS(SUM([利益]))>ABS(-SUM([利益])) THEN SUM([利益])
ELSE ABS(-SUM([利益]))
END

「表示範囲」と「-表示範囲」を詳細に設定する。
Untitled (9).png
リファレンスラインを2つ作成。「表示範囲」の最大値、「‐表示範囲」の最小値を表示するように設定する。
Untitled (10).png
Untitled (11).png

完成。
Untitled (12).png
Untitled (13).png
Untitled (14).png

おわりに

リファレンスラインによる軸範囲の調整はかなり便利なので活用できると色んなビューに対応できるようになるかと思います。是非いろんな場面に活用してみてください。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?