Skip to content

Connecting Power BI to BigQuery for GA4: service account, events tables, and Import

GA4 in Power BI

By Boris Parov8 min read

Lire cet article en français

Connecting Power BI to BigQuery for GA4 takes one identity, minimal roles, and one bounded Import query. On Google's public sample, that query returns 118,380 session rows for January 2021, against 1,210,147 raw events. Reading the raw events_* tables directly is the dead end, as our guide to GA4 in Power BI shows on the same data.

Which identity should Power BI use: an organizational account or a service account?

A GA4 model in Power BI should refresh under an identity that outlives any one employee. The standard Google BigQuery connector offers two sign-ins. The organizational account signs in with a person's Google account, through OAuth. The Service Account Login takes a service account email and its JSON key, pasted on one line.

A service account is a Google Cloud identity that belongs to an application, not to a person, and receives IAM roles like a user does. It differs from a personal account in that nobody signs in with a password: it authenticates with a key or with a federated token.

The personal account fits exploration in Power BI Desktop. It breaks the scheduled refresh the day its owner leaves or loses access. The service account fixes that, but it brings a key to manage. A key is a long-lived secret, and Google recommends blocking key creation in most projects. Organizations created on or after May 3, 2024 enforce that block by default.

When keys are blocked, the keyless route is a second connector: Google BigQuery (Microsoft Entra ID). It exchanges a Microsoft Entra ID token through Google's workforce identity federation. No key file exists on either side.

Sign-inConnectorSecret held by Power BIFits
Organizational account (OAuth)Google BigQueryA token tied to one personDesktop exploration, prototypes
Service Account LoginGoogle BigQueryThe service account's JSON keyScheduled refresh, where keys are allowed
Microsoft Entra IDGoogle BigQuery (Microsoft Entra ID)None: a federated token exchangeScheduled refresh, where keys are blocked

If you must use a key, keep one service account per model. Paste the key into the Power BI credential only, then delete the downloaded file.

Which BigQuery roles does the Power BI identity need?

For the Power BI read, the identity needs two BigQuery roles: Job User and Data Viewer. Job User lets it run query jobs, and every refresh is a query job. Data Viewer lets it read tables. Google grants Job User at project level only; it can't be set on a dataset. Data Viewer can be granted on one dataset, or even on a single table or view.

Grant Data Viewer on the modeled dataset, not on the raw export. Grant Job User on the billing project, the project that runs Power BI's jobs. The billing project can differ from the project that holds the data.

One more permission set is easy to miss. The connector reads results through the BigQuery Storage API by default. That path needs the bigquery.readsessions permissions, bundled in the BigQuery Read Session User role. Grant it on the billing project, or turn off Use Storage API in the advanced options.

RoleGranted onWhat it allowsWhy Power BI needs it
BigQuery Job UserBilling projectRun query jobs (bigquery.jobs.create)Every refresh is a query job
BigQuery Data ViewerOne dataset, table, or viewRead tables and their metadataRead the modeled tables, nothing else
BigQuery Read Session UserBilling projectCreate and read Storage API sessionsThe connector's default read path

Skip the broader BigQuery User role. It bundles jobs and read sessions, but it also lets the identity create datasets. A reporting identity has no reason to create anything. A transformation pipeline is a separate identity, with its own roles. It writes, so it holds Data Editor on the one dataset it fills.

Why shouldn't Power BI read the events_* tables directly?

Power BI shouldn't read the events_* tables directly, because they are daily shards of nested event rows. The GA4 export writes one table per day, named events_YYYYMMDD. There is no single table to point the navigator at.

A wildcard table is a BigQuery query construct that reads every table matching a prefix, such as events_*, as one table. It differs from a real table in that the pseudo-column _TABLE_SUFFIX decides which daily tables are scanned, and the filter must use constant values to limit the scan.

Loading the raw tables raises three problems. First, the wildcard exists only in SQL, so each daily table is a separate object to the navigator. Second, the connector loads nested fields as text columns in JSON format, per Microsoft's documentation. The event_params, items, and user_properties fields then need parsing in Power Query, at every refresh. Third, the volume is the event grain: 1,210,147 rows for January 2021 on the sample.

Bytes add a fourth problem. Wildcard queries over several tables don't use cached results. Each refresh therefore rescans what it reads. A filter on _TABLE_SUFFIX built from a subquery doesn't limit the scan either.

How do you plug Power BI into modeled tables?

Power BI should read a view or table that already flattens the export to the report's grain. Below is the bounded staging query Power BI runs, or the body of the view it reads. It reduces events to sessions, extracts ga_session_id from event_params, and keeps two dimensions.

WITH events AS (
  SELECT
    user_pseudo_id,
    (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS ga_session_id,
    PARSE_DATE('%Y%m%d', event_date) AS event_date,
    device.category AS device_category,
    geo.country AS country,
    event_name
  FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20210101' AND '20210131'
)
SELECT
  user_pseudo_id,
  ga_session_id,
  MIN(event_date) AS session_date,
  ANY_VALUE(device_category) AS device_category,
  ANY_VALUE(country) AS country,
  COUNT(*) AS event_count,
  COUNTIF(event_name = 'purchase') AS purchase_events
FROM events
WHERE user_pseudo_id IS NOT NULL AND ga_session_id IS NOT NULL
GROUP BY user_pseudo_id, ga_session_id
Result, January 2021Value
Event rows read (31 daily tables)1,210,147
Session rows returned to Power BI118,380
Purchase events, counted per session1,204
Sessions with at least one purchase1,115
Bytes processed by the query (dry run)304,513,057
Bytes processed, same query on 2020-11-01 to 2021-01-31 (dry run)1,125,380,830

Computed on 2026-10-15 on the public sample bigquery-public-data.ga4_obfuscated_sample_ecommerce (Google Merchandise Store, 2020-11-01 to 2021-01-31, obfuscated data).

Every January event carries a session key, so the 118,380 rows keep all 1,210,147 events as counts. The bounds also set the bytes: three months scan 3.7 times January's bytes, rounded to one decimal. The sample is obfuscated and dated; read the ratios, not the volumes.

Put the query in a view or a table in a separate dataset, never in the export dataset. A wildcard query fails if any view in its dataset matches the wildcard. A scheduled build then turns the view into a daily table: Dataform or dbt for the GA4 export: what incremental models change. A native query in the SQL statement option also works, with fully qualified table names. A view is easier to review, version, and grant.

Why is Import the default, and how often should it refresh?

Import is the default mode for a GA4 model, because the export lands once a day. A daily Import loses no freshness against a daily source.

An Import model is a Power BI semantic model that stores a compressed copy of the data in memory and refreshes it on a schedule. It differs from DirectQuery in that no query reaches the source between two refreshes.

DirectQuery sends a BigQuery query for each visual, at each interaction. Microsoft also lists a known issue: the DateTime type isn't supported through DirectQuery with this connector. The full comparison, with size thresholds: Import or DirectQuery for the GA4 export: the choice that decides everything. Other ways to read BigQuery from Power BI, such as a semantic layer or a third-party connector, are in Power BI on BigQuery: five options and when to choose each.

Refresh runs in the Power BI service through a cloud connection to BigQuery. A Pro workspace allows eight scheduled refreshes a day. One refresh after the daily export is enough. Google still updates each daily table up to two calendar days after its date, plus today. The bounded query handles that: the date filter becomes a rolling window over the last days. Partitions, parameters, and policy: Incremental refresh on the GA4 export: reload only the last few days.

What are the frequent BigQuery connector errors in Power BI?

Most BigQuery connector errors in Power BI come from a missing billing project or a missing permission. The table lists the messages Microsoft documents. The navigator only shows the projects and datasets your identity can see. BigQuery Metadata Viewer granted on a dataset alone doesn't make the project appear.

Message or symptomCauseFix
Access Denied: ... bigquery.jobs.create permissionsNo billing project set, or no Job User on itSet Billing Project ID; in the service, write BillingProject in the M code
(131) Unable to authenticate with Google BigQuery Storage APIMissing bigquery.readsessions permissionsGrant Read Session User, or turn off Use Storage API
The navigator doesn't list the data projectNo Browser role at project levelConnect through the billing project, then use a view or a native query
event_params and items arrive as JSON textRaw export table loaded as isFlatten in SQL before Power BI
A wildcard query fails after a new viewA view in the export dataset matches events_*Keep views in a separate dataset
HTTP Error 403: quotaExceeded on project.listsMany reports refresh at the same timeStagger refreshes; set BillingProject in the M code

One error comes before all the others. The Service Account Login rejects a JSON key that keeps its line breaks. Remove every new line, then paste the key as a single line.

FAQ

Does Power BI need a gateway to refresh from BigQuery?

Power BI refreshes from BigQuery without a gateway. The BigQuery connector is available in the Power BI service through a cloud-to-cloud connection. A gateway stays optional, for organizations that route connections through one. The Entra ID connector also supports single sign-on through a gateway.

Which project is billed for the queries Power BI runs?

The billing project set in the connector runs and pays for Power BI's query jobs. If you leave Billing Project ID empty, the connector takes the first available project returned by Google APIs. That default is rarely the one you want. Set it explicitly, and grant Job User on that project only. The Entra ID connector makes the field mandatory.

Can I connect Power BI to BigQuery with a service account and no key?

Not with the standard Google BigQuery connector: its Service Account Login requires the JSON key contents. The keyless route is the Google BigQuery (Microsoft Entra ID) connector. Your Google Cloud administrator sets up a workforce identity pool with an OIDC provider for Entra ID. Cloud connections use the default audience URI, built on your Power BI tenant ID.

Should I switch to the new ADBC implementation of the connector?

Microsoft recommends the ADBC-based implementation for new workloads, and the connector is moving off the ODBC driver. It runs in 64-bit Power BI Desktop only. Microsoft lists two known limitations: no relationships and no proxy. It may also need different BigQuery permissions, so test a refresh with your service identity first.

Set the identity and the roles once, then build every page on modeled tables. The rest of GA4 in Power BI: connector, BigQuery export, or semantic model? covers what comes after the connection. To get the next methods as they ship: Get new analyses as they ship.

Sources