Google Cloud Billing invoice Costs 
Display your Google Cloud Platform billing costs straight from BigQuery. invoice cost exclude discounts
Display your Google Cloud Platform billing costs straight from BigQuery.
{
  "__inputs": [
    {
      "name": "DS_BIGQUERY",
      "label": "bigquery",
      "description": "",
      "type": "datasource",
      "pluginId": "doitintl-bigquery-datasource",
      "pluginName": "Google BigQuery"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "datasource",
      "id": "doitintl-bigquery-datasource",
      "name": "Google BigQuery",
      "version": "2.0.3"
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.4.3"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "Display your Google Cloud Platform billing costs straight from BigQuery. invoice cost exclude discounts",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 18449,
  "graphTooltip": 1,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "doitintl-bigquery-datasource",
        "uid": "${DS_BIGQUERY}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "decimals": 2,
          "displayName": "Total Cost (Rp)",
          "mappings": [],
          "min": 0,
          "noValue": "No data",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "super-light-green",
                "value": null
              }
            ]
          },
          "unit": "currencyIDR"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 4,
        "x": 2,
        "y": 0
      },
      "id": 20,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "9.4.3",
      "targets": [
        {
          "dataset": "all_billing_data",
          "datasource": {
            "type": "doitintl-bigquery-datasource",
            "uid": "${DS_BIGQUERY}"
          },
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "orderByCol": "1",
          "orderBySort": "1",
          "partitioned": true,
          "partitionedField": "",
          "project": "shared-it-321504",
          "rawQuery": true,
          "rawSql": "SELECT\n  CURRENT_TIMESTAMP() AS time,\n  (sum(cost) + SUM(IFNULL((SELECT SUM(c.amount) FROM UNNEST(credits) c), 0))) AS value\nFROM\n  `$source_table`\nWHERE\n  $__timeFilter(usage_start_time) AND\n  project.id IN ($project)\nGROUP BY 1\nORDER BY 1 ASC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "cost"
                ],
                "type": "column"
              },
              {
                "params": [
                  "sum"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "cost"
                ],
                "type": "alias"
              }
            ]
          ],
          "sharded": false,
          "table": "",
          "timeColumn": "usage_start_time",
          "timeColumnType": "TIMESTAMP",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "name": "",
              "params": [
                "project.id",
                "IN",
                "($project)"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "transparent": true,
      "type": "stat"
    },
    {
      "datasource": {
        "type": "doitintl-bigquery-datasource",
        "uid": "${DS_BIGQUERY}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 2,
          "mappings": [],
          "unit": "currencyIDR"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 0
      },
      "id": 51,
      "links": [],
      "maxDataPoints": 50,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "doitintl-bigquery-datasource",
            "uid": "${DS_BIGQUERY}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "orderByCol": "1",
          "orderBySort": "1",
          "rawQuery": true,
          "rawSql": "SELECT\n  CURRENT_TIMESTAMP() AS time,\n  IF(pos > 50, 'Other', metric) AS metric,\n  SUM(value) AS value\nFROM (\n  SELECT\n    project.name AS metric,\n    (sum(cost) + SUM(IFNULL((SELECT SUM(c.amount) FROM UNNEST(credits) c), 0))) AS value,\n    ROW_NUMBER() OVER (ORDER BY SUM(cost) DESC) AS pos\n  FROM\n    `$source_table`\n  WHERE\n    $__timeFilter(usage_start_time) AND\n    project.id IN ($project)\n  GROUP BY 1\n)\nGROUP BY 2\nORDER BY metric != 'Other' DESC, 3 DESC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "-- value --"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "-- time --",
          "timeColumnType": "TIMESTAMP",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Project Breakdown",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "doitintl-bigquery-datasource",
        "uid": "${DS_BIGQUERY}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 2,
          "mappings": [],
          "unit": "currencyIDR"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 0
      },
      "id": 52,
      "links": [],
      "maxDataPoints": 50,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "doitintl-bigquery-datasource",
            "uid": "${DS_BIGQUERY}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "orderByCol": "1",
          "orderBySort": "1",
          "rawQuery": true,
          "rawSql": "SELECT\n  CURRENT_TIMESTAMP() AS time,\n  IF(pos > 20, 'Other', metric) AS metric,\n  SUM(value) AS value\nFROM (\n  SELECT\n    service.description AS metric,\n    (sum(cost) + SUM(IFNULL((SELECT SUM(c.amount) FROM UNNEST(credits) c), 0))) AS value,\n    ROW_NUMBER() OVER (ORDER BY SUM(cost) DESC) AS pos\n  FROM\n    `$source_table`\n  WHERE\n    $__timeFilter(usage_start_time) AND\n    project.id IN ($project)\n  GROUP BY 1\n)\nGROUP BY 2\nORDER BY metric != 'Other' DESC, 3 DESC",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "-- value --"
                ],
                "type": "column"
              }
            ]
          ],
          "timeColumn": "-- time --",
          "timeColumnType": "TIMESTAMP",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Top 20 Service Breakdown",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "doitintl-bigquery-datasource",
        "uid": "${DS_BIGQUERY}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "Cost (Rp)",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "decimals": 2,
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "currencyIDR"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 9
      },
      "id": 49,
      "options": {
        "legend": {
          "calcs": [
            "sum"
          ],
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "sortBy": "Total",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "pluginVersion": "9.4.3",
      "targets": [
        {
          "dataset": "all_billing_data",
          "datasource": {
            "type": "doitintl-bigquery-datasource",
            "uid": "${DS_BIGQUERY}"
          },
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "orderByCol": "1",
          "orderBySort": "1",
          "partitioned": false,
          "partitionedField": "",
          "project": "shared-it-321504",
          "rawQuery": true,
          "rawSql": "SELECT *\nFROM (\n  SELECT\n    $__timeGroup(usage_start_time, 1d),\n    service.description AS metric,\n    (sum(cost) + SUM(IFNULL((SELECT SUM(c.amount) FROM UNNEST(credits) c), 0))) AS value\n  FROM\n    `$source_table`\n  WHERE\n    $__timeFilter(usage_start_time) AND project.id IN ($project)\n  GROUP BY 1, 2\n  ORDER BY 1 ASC\n)\nWHERE value > 0",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "-- value --"
                ],
                "type": "column"
              }
            ]
          ],
          "sharded": false,
          "timeColumn": "-- time --",
          "timeColumnType": "TIMESTAMP",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "title": "Service Breakdown",
      "type": "timeseries"
    }
  ],
  "refresh": "1d",
  "revision": 1,
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "doitintl-bigquery-datasource",
          "uid": "${DS_BIGQUERY}"
        },
        "definition": "SELECT DISTINCT project.id FROM `$source_table`",
        "hide": 0,
        "includeAll": true,
        "label": "Project",
        "multi": true,
        "name": "project",
        "options": [],
        "query": "SELECT DISTINCT project.id FROM `$source_table`",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": false,
          "text": "shared-it-321504",
          "value": "shared-it-321504"
        },
        "hide": 0,
        "label": "Source Project",
        "name": "source_project",
        "options": [],
        "query": "shared-it-321504",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {
          "selected": false,
          "text": "all_billing_data",
          "value": "all_billing_data"
        },
        "hide": 0,
        "label": "Source Dataset",
        "name": "source_dataset",
        "options": [],
        "query": "all_billing_data",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "current": {},
        "datasource": {
          "type": "doitintl-bigquery-datasource",
          "uid": "${DS_BIGQUERY}"
        },
        "definition": "SELECT CONCAT(table_catalog, \".\", table_schema, \".\", table_name) FROM `$source_project.$source_dataset.INFORMATION_SCHEMA.TABLES` WHERE REGEXP_CONTAINS(table_name, \"^gcp_billing_export_v1_\")",
        "hide": 0,
        "includeAll": false,
        "label": "Source Table",
        "multi": false,
        "name": "source_table",
        "options": [],
        "query": "SELECT CONCAT(table_catalog, \".\", table_schema, \".\", table_name) FROM `$source_project.$source_dataset.INFORMATION_SCHEMA.TABLES` WHERE REGEXP_CONTAINS(table_name, \"^gcp_billing_export_v1_\")",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "2022-12-31T17:00:00.000Z",
    "to": "now"
  },
  "timepicker": {
    "hidden": false,
    "nowDelay": "",
    "refresh_intervals": [
      "1d"
    ]
  },
  "timezone": "Asia/Jakarta",
  "title": "Google Cloud Billing invoice Costs ",
  "uid": "0xLhbCB4k",
  "version": 1,
  "weekStart": ""
}