LoginSignup
3
0

More than 3 years have passed since last update.

Lookerのグラフからnullを描画対象外にする方法

Last updated at Posted at 2019-08-29

BIツールを使っていると、時系列データの線グラフを描画した場合、日付に欠損データが存在した場合、その日付けのデータが0になり、見た目がカクカクした感じになる場合があります。

こういった場合、tableauでは時系列データの属性を変更することで、NULLのデータをスルー可能でしたが、Lookerでも同様な機能がありましたので紹介します。

やりたい事

時系列データに欠損がある場合、グラフの描画対象外にしたい

データ

株のデータのため、土日祝日はデータがない状態

Date bond_cd close_sum
2019-03-01 9684 3340
2019-03-04 9684 3325
2019-03-05 9684 3270
2019-03-06 9684 3350
2019-03-07 9684 3265
2019-03-08 9684 3215
2019-03-11 9684 3270
2019-03-12 9684 3285

LookML

  dimension_group: Date {
    type: time
    timeframes: [
      raw,
      date,
      week,
      month,
      quarter,
      year
    ]
    convert_tz: no
    datatype: date
    sql: ${TABLE}.Date ;;
  }

  dimension: bond_cd {
    type: number
    sql: ${TABLE}.bond_cd ;;
  }

  measure: close_sum {
    type: sum
    sql: ${TABLE}.Close ;;
  }

Lookerでviewに読み込むと、日付項目は自動的にNULL設定される仕様の為、描画すると以下のようになる
nullを描画対象外1.PNG

対処方法

DATAの項目毎の設定から、Remove Filled in Datesを選択して再度DBへアクセスを行う
nullを描画対象外2.PNG

nullを描画対象外3.PNG

まとめ

土日祝日などでデータが存在しない場合、Lookerでは日付項目が自動的にNULL設定される仕様ですので、上記のようにNULLのデータは対象外にする設定を行う必要があります。

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