DAX measures for GA4: sessions, users, conversion rate, and additivity
DAX measures for GA4 break in one place: additivity. Sessions add up across days, users don't, and conversion rates never do. On Google's public sample, summing daily users overstates January 2021 by 12.4%: 106,565 against 94,790. Our guide to GA4 in Power BI sets the model; this page writes its measures.
Why use an explicit measure rather than a column?
An explicit measure fixes the aggregation once, while a numeric column lets each visual choose its own. Drag a users column into a visual and Power BI creates an implicit measure. Its default aggregation is a sum. For sessions, that sum is almost right. For users, it's wrong once two days share a row. Nothing on the page warns the reader.
An explicit measure is a DAX formula stored in the semantic model under a name, evaluated in the filter context of each visual. It differs from an implicit measure, which Power BI creates when a numeric column is dragged into a visual, with an aggregation the report author never wrote.
Explicit measures bring three guarantees. They carry a name, a description, and a format string, identical on every page. They are the only measures a calculation group can rewrite, according to Microsoft Learn. And they let you hide the raw numeric columns, so nobody rebuilds a sum by drag and drop.
A semantic model is the Power BI layer that holds tables, relationships, and measures, defined once for every report page. It differs from a report file in that a new page or visual never changes a definition.
The practical rule follows. Keep the measures in one dedicated table, grouped by display folder. Hide every numeric column of the fact tables. Then turn on the model property that discourages implicit measures, which calculation groups require anyway.
Check this first when you inherit a prebuilt report. The limits of a Power BI GA4 template list what else to check. Where measures sit also shapes the choice of tool, as choosing a GA4 reporting tool for each team explains.
Sessions: DISTINCTCOUNT or the sum of a daily fact?
GA4 sessions are additive as long as each session belongs to exactly one day in your fact table. The export has no sessions table: a session is a user_pseudo_id paired with a ga_session_id. The definition itself is covered in counting GA4 sessions in BigQuery without getting it wrong. The DAX question is where that key sits.
In an event-grain fact, DISTINCTCOUNT on a session key is exact but scans millions of rows. In a session-grain fact, one row per session, COUNTROWS is exact and much lighter. The choice of grain belongs to a star schema for GA4 in Power BI, with its facts, dimensions, and grain. The query below measures how far each grain drifts when you sum it.
WITH base AS (
SELECT
PARSE_DATE('%Y%m%d', event_date) AS day,
user_pseudo_id,
CONCAT(user_pseudo_id, '-', CAST((SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS STRING)) AS session_key
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20210101' AND '20210131'
),
by_period AS (
SELECT 'day' AS grain, day AS period, COUNT(DISTINCT session_key) AS sessions, COUNT(DISTINCT user_pseudo_id) AS users
FROM base GROUP BY day
UNION ALL
SELECT 'week', DATE_TRUNC(day, ISOWEEK), COUNT(DISTINCT session_key), COUNT(DISTINCT user_pseudo_id)
FROM base GROUP BY 2
UNION ALL
SELECT 'month', DATE_TRUNC(day, MONTH), COUNT(DISTINCT session_key), COUNT(DISTINCT user_pseudo_id)
FROM base GROUP BY 2
)
SELECT grain, COUNT(*) AS periods, SUM(sessions) AS summed_sessions, SUM(users) AS summed_users
FROM by_period
GROUP BY grain
ORDER BY periods DESC
| Grain, January 2021 | Periods | Summed sessions | Summed users |
|---|---|---|---|
| Day | 31 | 118,618 | 106,565 |
| ISO week, cut at the month's edges | 5 | 118,410 | 99,451 |
| Month | 1 | 118,380 | 94,790 |
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).
Daily sums of sessions drift by 238, or 0.2%. These are sessions that cross midnight, counted once on each day. A session fact dated by its first event removes the drift, since each session lands on one day.
-- Session-grain fact: one row per session, dated by its first event
Sessions =
COUNTROWS ( 'Fact Sessions' )
-- Event-grain fact: exact too, but heavy on large tables
Sessions (event grain) =
DISTINCTCOUNT ( 'Fact Events'[session_key] )
Users: why does the sum lie, and which three measures should you keep?
The sum of users lies because one person active on several days counts once per day. On the public sample, January 2021 holds 94,790 distinct users. Summed by day, they become 106,565, or 12.4% more. Summed by ISO week, they become 99,451, or 4.9% more. A coarser period shrinks the overstatement, but never removes it.
An additive measure is a measure whose value over a period equals the sum of its values over the sub-periods, like sessions or revenue. It differs from a distinct count, like users, which must be recomputed on the raw keys for each period and each filter.
The answer is three volume measures, each named for what it adds.
| Measure | DAX | Additive across days | Use it for |
|---|---|---|---|
Sessions | COUNTROWS on the session fact | Yes | Every total and every breakdown |
Daily Users | SUM of a daily fact | Yes, by construction | Trends and breakdowns by day |
Users | DISTINCTCOUNT on user_pseudo_id | No | Totals over a period |
Daily Users =
SUM ( 'Fact Daily Users'[users] )
-- Same logic without a daily fact: one distinct count per day, then a sum
Daily Users (from sessions) =
SUMX (
VALUES ( 'Date'[Date] ),
CALCULATE ( DISTINCTCOUNT ( 'Fact Sessions'[user_pseudo_id] ) )
)
Users =
DISTINCTCOUNT ( 'Fact Sessions'[user_pseudo_id] )
Pattern checked against the DAX function reference. It was not run on a model, so no figure is claimed from it.
Counting distinct users upstream in BigQuery
On a large property, the user key is the model's costliest column. DAX offers APPROXIMATEDISTINCTCOUNT, in preview for Import mode, with about 1.6% error per Microsoft Learn. It still needs the user key loaded, and Microsoft warns it can use more memory than DISTINCTCOUNT. And no DAX function reads BigQuery's HyperLogLog++ sketches, which reach Power BI as bytes.
The lasting answer is counting upstream. BigQuery computes users at the grains your pages need, such as month by channel. The model imports those counts. Daily sketches merge into a monthly estimate:
WITH daily AS (
SELECT
event_date,
COUNT(DISTINCT user_pseudo_id) AS daily_users,
HLL_COUNT.INIT(user_pseudo_id) AS users_sketch
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20210101' AND '20210131'
GROUP BY event_date
)
SELECT
SUM(daily_users) AS sum_of_daily_users,
HLL_COUNT.MERGE(users_sketch) AS users_from_daily_sketches
FROM daily
| Users, January 2021 | Value |
|---|---|
| Sum of daily users | 106,565 |
| Merge of 31 daily HyperLogLog++ sketches | 94,784 |
| Exact distinct count, month row of the grain query | 94,790 |
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).
The Users measure then returns the pre-counted value when the filter matches a pre-counted grain, and BLANK elsewhere. A blank cell is honest; a summed user count is not. Why these users still differ from the GA4 interface is another question: GA4 users, and why BigQuery and the interface never show the same number.
Conversion rate: a ratio of measures, with a gap in points
A conversion rate must divide two measures in the current filter context, never average a rate column. The query below computes the rate both ways, for December 2020 and January 2021. A converting session is a session with at least one purchase event.
WITH sessions AS (
SELECT
SUBSTR(_TABLE_SUFFIX, 1, 6) AS month_suffix,
event_date,
CONCAT(user_pseudo_id, '-', CAST((SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS STRING)) AS session_key,
LOGICAL_OR(event_name = 'purchase') AS has_purchase
FROM `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20201201' AND '20210131'
GROUP BY month_suffix, event_date, session_key
HAVING session_key IS NOT NULL
),
daily AS (
SELECT month_suffix, SAFE_DIVIDE(COUNTIF(has_purchase), COUNT(*)) AS daily_rate
FROM sessions
GROUP BY month_suffix, event_date
),
monthly AS (
SELECT
month_suffix,
COUNT(DISTINCT session_key) AS sessions,
COUNT(DISTINCT IF(has_purchase, session_key, NULL)) AS purchase_sessions
FROM sessions
GROUP BY month_suffix
)
SELECT
m.month_suffix, m.sessions, m.purchase_sessions,
ROUND(100 * m.purchase_sessions / m.sessions, 2) AS conversion_rate_pct,
ROUND(100 * AVG(d.daily_rate), 2) AS avg_of_daily_rates_pct
FROM monthly AS m
JOIN daily AS d USING (month_suffix)
GROUP BY m.month_suffix, m.sessions, m.purchase_sessions
ORDER BY m.month_suffix
| Month | Sessions | Purchase sessions | Conversion rate | Average of daily rates |
|---|---|---|---|---|
| 2020-12 | 133,368 | 2,116 | 1.59% | 1.47% |
| 2021-01 | 118,380 | 1,115 | 0.94% | 0.92% |
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).
The average of daily rates gives a quiet day the weight of a busy one. In December 2020, it lands 0.12 points under the true rate.
Purchase Sessions =
CALCULATE ( [Sessions], 'Fact Sessions'[has_purchase] = TRUE () )
Conversion Rate =
DIVIDE ( [Purchase Sessions], [Sessions] )
The DIVIDE function returns BLANK when there are no sessions, instead of an error. The gap between two rates is a difference in points. From December 2020 to January 2021, the rate went from 1.59% to 0.94%. That's −0.65 points, on rates rounded to two decimals. As a relative change, the same move reads −41%, rounded to the unit. A reader takes that for a 41-point fall. Volumes compare in percent; rates compare in points, written "+0.4 pp".
Period comparisons: one calculation group, not companion measures
A calculation group writes the previous period and the change once, for every measure in the model. Without one, each base measure grows companions: Sessions PY, Sessions Δ%, Users PY, and so on. Forty base measures become 120, and every fix is made three times.
A calculation group is a table of the semantic model whose items rewrite the measure in a visual through SELECTEDMEASURE(). It differs from a set of companion measures in that a time shift or a change is written once and applies to every measure.
GA4 models need two groups. The first serves volumes: current period, previous period, and change in percent. The second serves rates and returns a difference in points. Applying a percent change to a conversion rate is exactly the −41% trap.
// Calculation item "Change pp", in the calculation group reserved for rates
VAR CurrentRate = SELECTEDMEASURE ()
VAR PreviousRate =
CALCULATE ( SELECTEDMEASURE (), DATEADD ( 'Date'[Date], -1, MONTH ) )
RETURN
IF (
NOT ISBLANK ( CurrentRate ) && NOT ISBLANK ( PreviousRate ),
( CurrentRate - PreviousRate ) * 100
)
Pattern checked against the DAX function reference, not run on a model for this article. The SELECTEDMEASURE() function only exists inside a calculation item, never in a plain measure. The item's format string, such as +0.00" pp";-0.00" pp", shows the sign and the unit. The DATEADD function needs a date table marked as such, with one row per day.
How do you check DAX measures for GA4 against BigQuery?
Check each DAX measure against one SQL query over the same days and the same definitions. Power BI Desktop runs DAX queries in its DAX query view. The query below returns every measure of this page by month, ready to compare.
EVALUATE
SUMMARIZECOLUMNS (
'Date'[Year Month],
"Sessions", [Sessions],
"Daily Users", [Daily Users],
"Users", [Users],
"Conversion Rate", [Conversion Rate]
)
| Measure | Filter | SQL reference on the public sample |
|---|---|---|
Sessions | January 2021 | 118,380 |
Daily Users | January 2021 | 106,565 |
Users | January 2021 | 94,790 |
Conversion Rate | December 2020, January 2021 | 1.59%, 0.94% |
Conversion Rate, item "Change pp" | January 2021 | −0.65 points |
Two traps explain most gaps. The Date table must join on event_date, which follows the property's time zone, not on the UTC timestamp. And the session fact must use the SQL's session key. Sessions without a ga_session_id are excluded on both sides. A measure that matches on one month and drifts on another usually has a time-zone problem. Keep these five checks in a file next to the model. Rerun them after every change to a measure. A check that passed once proves nothing about the next definition.
FAQ
Why doesn't my Power BI users total match the sum of the rows?
A users total is a distinct count, so it never equals the sum of its rows. A user active on two days appears on two rows but counts once in the total. That's correct behavior, documented for DISTINCTCOUNT by Microsoft. The total is wrong only when the measure is a sum of users.
Should I use APPROXIMATEDISTINCTCOUNT for GA4 users?
Use it only when an estimate is acceptable and the user key is already in the model. In Import mode, Microsoft lists it as a preview, with an error of about 1.6%. It can speed up counts on a high-cardinality column. It never shrinks the model, because the column stays loaded. Counting users upstream in BigQuery saves both.
Can Power BI read BigQuery HyperLogLog sketches?
Power BI can import a sketch column, but only as binary data. No DAX function merges or reads HyperLogLog++ sketches. Merge them in BigQuery with HLL_COUNT.MERGE at the grains your pages need, then import the counts.
Why is my Power BI conversion rate different from the GA4 interface?
The GA4 interface and your model rarely share a definition. The interface computes its session key event rate on the key events you marked. A model on the export divides sessions with a purchase by all sessions with a session ID. Write your definition in the measure description so readers know which one they see.
Write each measure once, name what it adds, and check it against SQL before anyone reads it. The full model sits in GA4 in Power BI: connector, BigQuery export, or semantic model?. To get the next analyses in SQL and DAX: Get new analyses as they ship.
Sources
- DISTINCTCOUNT function (DAX) (opens in a new tab) - Microsoft Learn, updated 2026-01-22, consulted 2026-10-15
- APPROXIMATEDISTINCTCOUNT function (DAX) (opens in a new tab) - Microsoft Learn, updated 2026-09-15, consulted 2026-10-15
- DIVIDE function (DAX) (opens in a new tab) - Microsoft Learn, updated 2026-01-22, consulted 2026-10-15
- Calculation groups in tabular models (opens in a new tab) - Microsoft Learn, updated 2026-06-11, consulted 2026-10-15
- HyperLogLog++ functions in GoogleSQL (opens in a new tab) - Google Cloud, updated 2026-10-13, consulted 2026-10-15
- BigQuery Export schema for Google Analytics 4 (opens in a new tab) - Google, consulted 2026-10-15