Why this matters
As a BI Analyst, you translate business questions into reliable metrics and dashboards. Getting filters and context wrong leads to misleading KPIs, inconsistent totals, and disputes with stakeholders. Correct handling ensures that measures behave predictably across pages, tiles, and drilldowns.
- Executive dashboards: ratios should remain consistent when slicing by region or product.
- Self-serve exploration: measures must be robust regardless of what users filter.
- Data governance: security and default filters must always apply.
Who this is for
- BI Analysts and Data Analysts building metrics and dashboards.
- Analytics Engineers defining measures in a semantic layer.
- Product and Ops analysts who need trustworthy self-serve analytics.
Prerequisites
- Basic understanding of dimensions, facts, joins, and grain.
- Familiarity with your BI tool's concepts: measures, filters, drilldowns, and total rows.
- Comfort reading pseudo-code for metric definitions.
Concept explained simply
Think of a calculation as being performed inside a bubble that contains the current filters. These filters come from many places: security (RLS), model defaults, dashboard filters, visual filters, and drilldowns. The result depends on what is inside the bubble.
Mental model
- Context = the set of filters (who, what, when) applied to a calculation.
- Propagation = which filters flow down to which tables through relationships.
- Isolation = the act of removing or restoring part of the context to compute stable measures (e.g., ignoring product when computing market share denominator).
- Precedence (typical): security filters â model defaults â report/page filters â visual/measure-level filters.
See common types of context
- Row-level filters: restrict the rows before aggregation.
- Aggregation context: grouping levels (e.g., by Region and Month).
- Evaluation context: additional logic inside a measure that can add/override filters.
Core ideas and terminology
- Keep relevant filters, remove irrelevant ones: A ratio often needs a denominator that ignores some dimension filters (like product) but respects others (like date and region).
- Respect security and defaults: Row-level security and required defaults should never be bypassed.
- Time context: Decide whether to use the latest date in context, a parameter date, or a default like yesterday.
- Multi-select logic: Know when filters are combined with AND vs OR across fields.
- Null handling and empty sets: Guard against divide-by-zero and missing dates.
Worked examples
Example 1: Stable Conversion Rate
Goal: Sessions with Completed Orders / Sessions. Product filters should not shrink Sessions in the denominator, but date and region should still apply.
- Numerator: count orders with status = Completed, honoring date + region + product (since you want the selected productâs conversions).
- Denominator: count sessions, honoring date + region, but ignoring product (so that product selection doesnât hide relevant sessions).
- Guardrail: if denominator = 0, return blank or 0 with a note.
Why ignore product on the denominator?
Users often filter to one product to inspect conversions, but sessions that started without that product selected could still lead to a conversion. The denominator should reflect the audience (date, region), not the product slice.
Example 2: Market Share Within Context
Goal: Product Sales / Total Sales in the same context, but the denominator should ignore Product filters and keep Date/Region filters.
- Numerator: sum(sales) with all applicable filters.
- Denominator: sum(sales) with Date/Region kept, Product removed.
- Result is comparable across products and totals add up logically if you aggregate using weighted methods.
Totals and subtotals gotchas
At total level (no product), your denominator and numerator may match; at product level, the denominator is larger than the numerator. This is expected.
Example 3: Year-to-Date Logic with Incomplete Periods
Goal: YTD Revenue should use the latest date in context. If no date is filtered, default to yesterday. Provide a toggle to include or exclude the current incomplete period.
- If IncludeCurrentIncompletePeriod = true, use current date; else use last completed period (e.g., last day of previous month).
- Always respect RLS and region filters.
- Prevent future dates from entering the YTD window.
Edge cases
- No dates selected: default to yesterday (or a defined reference date).
- Partial data loads: exclude current date if your load is incomplete.
How to implement correctly
- Define the base measures first: raw counts and sums that respect context.
- Create adjusted measures: remove or restore specific filters only when needed (e.g., ignore Product for a denominator).
- Add guardrails: handle divide-by-zero, nulls, and empty sets.
- Parameterize time behavior: allow toggles for incomplete periods or custom date anchors.
- Test across contexts: visual-level, page-level, and report-level filters; totals and subtotals; different dimensions.
Debugging checklist
- Display âRows in contextâ as a diagnostic measure when testing.
- Add temporary KPIs: Denominator (raw), Denominator (adjusted), Numerator.
- Compare a filtered visual vs the total row to spot unexpected filter bleed.
Exercises you can practice
Note: The quick test is available to everyone. Only loggedâin users will have their progress saved.
Exercise 1: Stable Conversion Rate
Build a Conversion Rate measure where the denominator ignores Product but respects Date and Region. Include divide-by-zero handling and test it across multiple filters.
What to verify
- Changing Product changes numerator but not denominator.
- Changing Date or Region affects both numerator and denominator.
- No errors when sessions are zero.
Exercise 2: Time-aware YTD with Toggle
Create YTD Revenue that uses the max date in context, defaults to yesterday if no date is set, and supports a boolean toggle IncludeCurrentIncompletePeriod.
What to verify
- With the toggle off, the latest day is excluded if incomplete.
- With the toggle on, YTD includes the current day/month to date.
- RLS and Region filters still apply.
Exercise 3: Top N with "Others" using Filter Isolation
Show Sales for top N Products and compute an "Others" bar as Total â TopN. Ensure Total ignores the TopN filter, but respects Date/Region.
What to verify
- Total respects Date/Region and RLS, but not the TopN limit.
- TopN respects the TopN control and dimension filters.
- Others = Total â TopN, never negative.
Exercise checklist
- Denominators are stable across irrelevant slices.
- Time defaults are defined and documented.
- Guardrails (zero/blank) are in place.
- RLS and defaults are never bypassed.
- Totals/subtotals reviewed for each measure.
Common mistakes and how to self-check
- Using raw counts as denominators that shrink with product/category filters. Fix: isolate denominator from that dimension.
- Inconsistent time anchors across tiles. Fix: centralize date logic; expose a parameter/toggle.
- Letting TopN change the total. Fix: compute Total with TopN removed.
- Ignoring RLS by removing too many filters. Fix: never use logic that bypasses security filters.
- Divide-by-zero errors. Fix: return blank/0 and add an explanatory tooltip or note.
Self-check method
- Build a test dashboard section with diagnostics for numerator/denominator and total.
- Toggle filters one by one (Product, Region, Date, TopN) and confirm expected behavior.
- Compare detail vs total rows to ensure isolation works.
Practical projects
- Conversion Suite: Build Conversion Rate, Add-to-Cart Rate, and Checkout Completion that all share stable denominators.
- Market Share Board: Product market share by region and month, with a toggle to switch between share by revenue vs units.
- Executive Time Pack: YTD, MTD, QTD measures with an IncludeCurrentIncompletePeriod toggle and a single trustworthy date anchor.
Mini challenge
Create an âActive Customers (90 days)â KPI that respects Region and RLS, ignores Product filters, and uses today-1 as a default anchor if no date filter is present. Add a companion KPI âActive Customers (All Products)â that always ignores Product. Verify totals and drilldowns behave as expected.
Learning path
- Revisit data model relationships and filter directions.
- Practice removing/keeping filters for denominators and totals.
- Add time parameters and defaults for robust date behavior.
- Validate with totals, subtotals, and TopN/limit scenarios.
- Package patterns into reusable measures or definitions.
Next steps
- Harden your key KPIs with filter isolation and guardrails.
- Add diagnostics to a hidden dashboard tab for ongoing QA.
- Move on to advanced time intelligence and scenario comparisons.
Take the quick test
Check your understanding below. Anyone can take the test; sign in to save your progress.