Skip to content

Hard Data Analytics Interview Questions

85 hard questions with answers. Design, trade-off and deep-dive questions asked for senior roles and at top product companies.

Topics in the hard set

A/B Testing & Experiments: 10 Power BI: 9 Data Modelling & Warehousing: 9 Statistics and Case Studies: 8 Dashboards and KPIs: 8 Web & Marketing Analytics: 8 SQL: 7 Data Cleaning: 7 Tableau: 6
Solved — hardStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

What does CALCULATE do in DAX?

Save to ▾
Show answer
CALCULATE evaluates an expression in a modified filter context, e.g. CALCULATE([Total Sales], Region[Name] = "North"). It is the key function for time intelligence and comparisons.
02

How would you segment customers?

Save to ▾
Show answer
Use RFM scoring or clustering on behaviour and value, validate segments with business teams and attach an action to each segment.
03

How would you calculate retention using SQL?

SQLHard
Save to ▾
Show answer
Find each user's first activity date as a cohort, join to later activity, and compute the share of each cohort active in day, week or month N.
04

Design a dashboard for CXOs — what principles do you follow?

Save to ▾
Show answer
Start from the business questions, show 4–6 top KPIs with trend vs target, allow drill-downs, keep colours consistent, remove clutter, add time/region filters and give one clear insight per visual.
05

How would you reconcile two large lists in Excel?

ExcelHard
Save to ▾
Show answer
Use XLOOKUP or COUNTIF to flag missing items in each list, or merge them in Power Query with a full outer join and filter unmatched rows.
06

How do you optimise a slow SQL query?

SQLHard
Save to ▾
Show answer
Read the execution plan, add or fix indexes, select only needed columns, filter early, avoid functions on indexed columns, and replace correlated subqueries with joins.
07

A marketing campaign shows more sales. How do you prove it worked?

Save to ▾
Show answer
Compare with a control group or use difference-in-differences, control for seasonality, and measure incremental sales against campaign cost.
08

How would you automate a weekly report with Python?

Save to ▾
Show answer
Pull data with SQL or APIs, clean and aggregate with Pandas, build charts and an Excel or PDF output, and schedule it with cron or Airflow with logging and alerts.
09

How would you design a sales dashboard for executives?

Save to ▾
Show answer
Start with KPIs (revenue, margin, growth), add trend and comparison to target, allow drill-down by region and product, keep it to one screen and test with the audience.
10

Find customers who ordered in January but not in February.

SQLHard
Save to ▾
Show answer
SELECT DISTINCT customer_id FROM orders WHERE month = 'Jan' EXCEPT SELECT customer_id FROM orders WHERE month = 'Feb';
11

Explain funnel analysis.

Save to ▾
Show answer
Track users through steps (visit → product view → cart → payment), compute conversion between each step, find the biggest drop, segment by device and source, and suggest fixes to test.
12

Your workbook has 200,000 rows and hundreds of VLOOKUPs and takes minutes to recalculate. What do you do?

ExcelHard
Save to ▾
Show answer
First switch calculation to manual to work safely, then find the cause. Replace whole-column references with Tables, swap repeated VLOOKUPs for one XLOOKUP or INDEX-MATCH helper column, and remove volatile functions like OFFSET, INDIRECT and TODAY used in many cells. Better still, move the joins into Power Query or the Data Model so lookups happen once at refresh. Finally paste values for historic data that never changes and keep formulas only where needed.
13

What is the LAMBDA function in Excel and when would you use it?

ExcelHard
Save to ▾
Show answer
LAMBDA lets you write a custom, reusable function with formulas only, no VBA. You define it, for example =LAMBDA(price, rate, price*(1+rate)), and save it in the Name Manager as AddGST, then call =AddGST(B2, 18%) anywhere. Helper functions like MAP, REDUCE, SCAN and BYROW pair with it for array logic. Use it when a complex calculation repeats across a workbook, so the logic lives in one tested place.
14

What is the difference between ALL, ALLEXCEPT and REMOVEFILTERS in DAX?

Save to ▾
Show answer
ALL removes filters from a table or columns and can also return all rows as a table. REMOVEFILTERS only removes filters and is clearer inside CALCULATE. ALLEXCEPT removes all filters on a table except the columns you list. A common use is share of total: DIVIDE([Sales], CALCULATE([Sales], ALL(Product))) gives each product's percentage, while ALLEXCEPT(Product, Product[Category]) gives share within its category.
15

What is a composite model in Power BI?

Save to ▾
Show answer
A composite model mixes storage modes in one dataset: some tables in Import, some in DirectQuery, and some in Dual. For example, a huge transaction table stays in DirectQuery for freshness while small dimension tables are imported for speed. Aggregation tables can be imported so most visuals hit memory, with DirectQuery used only for detailed drill-down. The trade-off is more complexity and relationship rules to manage.
16

Your Power BI dataset with five years of transactions takes two hours to refresh. How would you fix it?

Save to ▾
Show answer
Incremental refresh partitions a large table by date so that each refresh reloads only recent data, for example the last 7 days, while older partitions stay untouched. You create RangeStart and RangeEnd parameters, filter the table with them in Power Query, and set a policy such as store 5 years, refresh 7 days. Refresh becomes faster and lighter on the source. Query folding must work for the filter to be pushed to the database.
17

Two tables have a many-to-many relationship and your report totals look inflated. What do you do?

Save to ▾
Show answer
Inflated totals usually mean rows are being double counted through the many-to-many path. I would first check whether a proper dimension table can sit between them, turning it into two one-to-many relationships, for example a bridge table of unique customer IDs. I would set single filter direction, test totals against the source with a simple SQL query, and use measures with DISTINCTCOUNT where needed. Many-to-many should be a deliberate choice, not a default.
18

Your Sales table has OrderDate and ShipDate. How do you analyse sales by ship date when only OrderDate is the active relationship?

Save to ▾
Show answer
-- create an inactive relationship Sales[ShipDate] -> 'Date'[Date] in the model Sales by Ship Date = CALCULATE( [Total Sales], USERELATIONSHIP(Sales[ShipDate], 'Date'[Date]) ) -- the measure uses the inactive relationship only inside this CALCULATE -- the alternative is a second role-playing date table
19

Your manager wants a visual that always shows the top 5 products for whatever region is selected in a slicer. How do you build it?

Save to ▾
Show answer
The simplest way is a visual-level Top N filter on Product, by the Total Sales measure, set to 5; it recalculates for every slicer selection. If the number must be user selectable, create a numeric what-if parameter and a ranking measure using RANKX over ALLSELECTED(Product), then filter the visual where rank is less than or equal to the parameter. I would also add an Others row if the business wants totals to still match.
20

Your pandas script takes 40 minutes on 10 million rows. How do you speed it up?

Save to ▾
Show answer
First profile to find the slow step instead of guessing. Common fixes: replace row-wise apply and loops with vectorised operations, convert repeated strings to category dtype, downcast numeric types, read only needed columns with usecols, and filter early. Push heavy joins and aggregations into SQL. If it is still slow, use a columnar engine such as DuckDB or Polars, or store intermediate data as Parquet instead of CSV.
21

Write Python code to fit a simple linear regression of sales on ad spend.

Save to ▾
Show answer
import pandas as pd import statsmodels.formula.api as smf df = pd.read_csv('marketing.csv') model = smf.ols('sales ~ ad_spend', data=df).fit() print(model.summary()) # coefficients, p-values, R-squared # predicted sales for a spend of 50,000 print(model.predict(pd.DataFrame({'ad_spend': [50000]})))
22

When would you choose Polars or DuckDB over pandas?

Save to ▾
Show answer
Choose them when data is large, roughly several gigabytes, or when pandas is slow or runs out of memory. DuckDB runs fast SQL directly on CSV and Parquet files on a laptop, ideal for analysts comfortable with SQL. Polars is a DataFrame library with lazy evaluation and multi-threading, often many times faster than pandas. pandas still wins for small data, its huge ecosystem and compatibility with most tutorials and libraries.
23

Write SQL to find the top 3 products by revenue within each category.

SQLHard
Save to ▾
Show answer
WITH ranked AS ( SELECT category, product, SUM(amount) AS revenue, DENSE_RANK() OVER ( PARTITION BY category ORDER BY SUM(amount) DESC ) AS rnk FROM sales GROUP BY category, product ) SELECT category, product, revenue FROM ranked WHERE rnk <= 3 ORDER BY category, rnk;
24

What is a query execution plan and how do you read it?

SQLHard
Save to ▾
Show answer
An execution plan shows how the database will run a query: which indexes it uses, join methods such as nested loop or hash join, scan types and estimated rows. You get it with EXPLAIN, or EXPLAIN ANALYZE for actual timings. Look for full table scans on big tables, large gaps between estimated and actual rows, and expensive sorts. These point to missing indexes, stale statistics or non-sargable filters like functions on columns.
25

What is a slowly changing dimension? Explain Type 1 and Type 2.

SQLHard
Save to ▾
Show answer
A slowly changing dimension handles attributes that change over time, like a customer's city. Type 1 overwrites the old value, so history is lost and past sales appear under the new city. Type 2 adds a new row with a new surrogate key plus valid_from, valid_to and is_current columns, so old sales stay linked to the old city. Type 2 preserves accurate history but makes the table larger and joins more careful.
26

Write SQL to find users who logged in on at least 3 consecutive days.

SQLHard
Save to ▾
Show answer
WITH d AS ( SELECT DISTINCT user_id, CAST(login_time AS DATE) AS dt FROM logins ), g AS ( SELECT user_id, dt, dt - CAST(ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY dt) AS INT) AS grp FROM d ) SELECT DISTINCT user_id FROM g GROUP BY user_id, grp HAVING COUNT(*) >= 3; -- gaps and islands: consecutive dates share the same grp value
27

How would you design an A/B test for a new checkout button?

Save to ▾
Show answer
Define one primary metric, such as checkout conversion, plus guardrails like refund rate. State the hypothesis and minimum detectable effect, then calculate sample size and duration for chosen power and significance. Randomise users, not sessions, into control and variant, check the split is balanced, and run for full weeks to cover weekday patterns. Do not peek and stop early. Finally analyse with a proportion test and check key segments.
28

What is Simpson's paradox? Give an example.

Save to ▾
Show answer
Simpson's paradox happens when a trend in several groups reverses when the groups are combined, because group sizes differ. Example: a new sales process has higher conversion in both small and large stores, yet overall conversion looks lower because it was mostly rolled out to large stores, which convert worse in general. The lesson is to check segments and confounding variables before concluding from aggregate numbers.
29

A retail chain asks you which of its 120 stores it should close. How do you approach it?

Save to ▾
Show answer
Clarify the goal first: profit, cash or market share. Build a store-level dataset with revenue, contribution margin after rent and staff, trend over 24 months, footfall, catchment demographics and cannibalisation with nearby stores. Separate structural losers from stores that are new or temporarily disrupted. Estimate how much revenue would shift to nearby stores or online if a store closes. Present a shortlist with scenarios and risks, not a single answer.
30

How do you calculate a simple customer lifetime value?

Save to ▾
Show answer
A simple formula is CLV = average order value x purchase frequency per year x gross margin x expected lifetime in years. Example: 800 rupees x 6 orders x 30 percent margin x 3 years = 4,320 rupees. Expected lifetime can be estimated as 1 divided by annual churn rate. A better version discounts future value and calculates CLV by cohort or segment, because averages hide very different customer groups.
31

An A/B test shows a 2% lift with p = 0.04, but it only ran for 3 days. Would you ship it?

Save to ▾
Show answer
Not yet. Three days misses weekly patterns, and early results are often inflated by novelty effects or by stopping once the p-value looked good. I would check whether the planned sample size was reached, whether the split was balanced, and how guardrail metrics behaved. I would recommend running to the pre-planned duration, at least one or two full weeks, and then deciding, considering the cost of being wrong.
32

Explain FIXED, INCLUDE and EXCLUDE LOD expressions in Tableau.

Save to ▾
Show answer
Level of Detail expressions compute aggregates at a level different from the view. FIXED computes at the dimensions you specify regardless of the view, for example { FIXED [Customer] : SUM([Sales]) } for lifetime sales per customer. INCLUDE adds a dimension to the view's level, such as average of per-customer sales by region. EXCLUDE removes a dimension, useful for comparing each month to the yearly total. FIXED ignores normal dimension filters unless they are context filters.
33

What is the order of operations in Tableau and why does it matter?

Save to ▾
Show answer
Tableau applies filters in a fixed order: extract filters, data source filters, context filters, then FIXED LOD calculations, dimension filters, INCLUDE and EXCLUDE LODs, measure filters, and finally table calculations and table calc filters. It matters because a calculation only sees data filtered before it. For example, a FIXED LOD ignores a normal region filter unless that filter is added to context. Many wrong totals come from not knowing this order.
34

A Tableau dashboard takes 30 seconds to load. How do you make it faster?

Save to ▾
Show answer
Start with the Performance Recorder to see whether time goes into queries, calculations or rendering. Then reduce work: use an extract with only needed columns and rows, aggregate it to the dashboard's grain, and hide unused fields. Cut the number of sheets and high-mark-count views, replace many quick filters with fewer or with action filters, and avoid show only relevant values. Simplify heavy string and LOD calculations or move them to the database.
35

How do you implement row-level security in Tableau?

Save to ▾
Show answer
The scalable approach is an entitlement table mapping usernames to allowed values, such as region managers to their regions. Relate or join it to the data, then add a calculated filter like USERNAME() = [Username] and apply it as a data source filter on the published source so it cannot be removed. For small cases, user filters or group-based functions like ISMEMBEROF work. Test by viewing as different users before release.
36

Your Tableau numbers change unexpectedly when a filter is applied to a view that uses a FIXED LOD. Why?

Save to ▾
Show answer
Usually it is the order of operations. FIXED LODs are computed before dimension filters, so they ignore a normal region filter, while other measures in the view respect it. That mix makes percentages and totals look inconsistent. Decide what the business wants: if the LOD should respect the filter, add the filter to context; if it should not, keep it and label it clearly, for example share of national sales.
37

Tableau or Power BI: how would you decide which one a team should use?

Save to ▾
Show answer
Both are capable, so the decision usually depends on context. Power BI fits teams already on Microsoft 365 and Azure, has lower per-user cost, and strong modelling with DAX. Tableau is often preferred for flexible visual exploration, very polished custom visuals and mixed-platform environments. I would also weigh existing skills, data sources, governance needs, licensing and embedding requirements, then run a short pilot on a real use case.
38

What are MCAR, MAR and MNAR missing data?

Save to ▾
Show answer
MCAR, missing completely at random, means missingness is unrelated to anything, like a random sensor glitch; dropping rows is mostly safe. MAR, missing at random, means missingness depends on other observed variables, for example older customers skipping the email field; impute using those variables. MNAR, missing not at random, means it depends on the missing value itself, like high earners hiding income; this biases results and needs careful handling or extra data.
39

The customer table has near-duplicates like 'Rahul Sharma, 98xxxx1234' and 'Rahul Sharma, +91 98xxxx1234'. How do you deduplicate?

Save to ▾
Show answer
First normalise: trim and lower-case names, collapse spaces, and strip country codes and symbols from phones and emails. Then match on strong keys such as phone or email. For remaining records use fuzzy matching on names with a similarity score, restricted to the same city or pin code to limit comparisons. Review borderline scores manually, keep a mapping from old IDs to a master ID, and fix entry at the source.
40

You loaded a month of sales into the warehouse. How do you check the load is complete and correct?

Save to ▾
Show answer
Reconcile against the source: compare row counts, total amount, and counts by day and by store between source and target. Check for duplicate keys, nulls in mandatory columns, and dates outside the expected month. Compare with the previous month to spot big unexplained jumps. Spot-check a few individual transactions end to end. Automate these checks so each future load produces a small pass or fail report.
41

Sales data from different countries mixes currencies and some weights are in grams while others are in kilograms. How do you handle it?

Save to ▾
Show answer
Never add mixed units. Identify the unit for each row from a currency or unit column, or infer it from the source system. Convert to one standard, for example INR using a dated exchange rate table joined on transaction date, and kilograms using a conversion factor. Keep the original value and unit columns for audit. Document which rates were used, and flag rows where the unit could not be determined.
42

The column names in a monthly vendor file keep changing. How do you make your cleaning pipeline robust?

Save to ▾
Show answer
Agree a data contract with the vendor if possible. In the pipeline, normalise headers by trimming, lower-casing and replacing spaces, then map known variants to standard names through a lookup table you maintain. Validate that all required columns exist after mapping and fail with a clear message if not, instead of producing silent blanks. Select columns by name, never by position, and log any unexpected new columns for review.
43

Where should data cleaning happen: Excel, SQL, Python or Power Query?

Save to ▾
Show answer
Clean as close to the source as is practical and in a repeatable tool. Fixes everyone needs belong upstream in the database or warehouse via SQL so all reports share them. Power Query suits report-specific shaping and Excel users. Python is best for complex logic like fuzzy matching or regex at scale. Manual Excel edits are fine for one-off exploration but should not be part of recurring reports because they cannot be reproduced.
44

How can you automate data quality checks in a reporting pipeline?

Save to ▾
Show answer
Define tests as code that run after every load: not-null and unique checks on keys, accepted value lists, referential integrity, row count within an expected range compared with recent days, and freshness of the latest timestamp. Store results in a table and alert the team on failures before dashboards refresh. Start with checks on the few tables behind key KPIs, then expand. This catches issues before stakeholders do.
45

How do you make sure a metric like active customer means the same thing across all teams?

Save to ▾
Show answer
Write a clear definition in a shared metric dictionary: formula, filters, time window, grain, owner and source table, for example a customer with at least one paid order in the last 90 days. Implement it once, in a governed dataset or semantic layer, and have all dashboards reuse it rather than recalculating. Version changes, announce them and show the definition in the dashboard tooltip. Review new metrics before they are published.
46

The finance dashboard and the sales dashboard show different revenue for last month. How do you resolve it?

Save to ▾
Show answer
Start by listing both definitions: gross or net of returns and discounts, with or without tax, booking date or invoice date, and which entities are included. Compare at a detailed level for one region to find exactly where the difference arises. Usually both are correct for their purpose. Agree with both owners which is the official revenue KPI, rename the other clearly, such as booked sales, and document it in the metric dictionary.
47

Write SQL to calculate monthly customer churn rate.

Save to ▾
Show answer
WITH active AS ( SELECT DISTINCT customer_id, DATE_TRUNC('month', order_date) AS month FROM orders ) SELECT a.month, COUNT(*) AS active_customers, COUNT(*) - COUNT(n.customer_id) AS churned_next_month, ROUND(100.0 * (COUNT(*) - COUNT(n.customer_id)) / COUNT(*), 1) AS churn_pct FROM active a LEFT JOIN active n ON n.customer_id = a.customer_id AND n.month = a.month + INTERVAL '1 month' GROUP BY a.month ORDER BY a.month;
48

What is a KPI tree and how does it help analysis?

Save to ▾
Show answer
A KPI tree breaks a top-level metric into the drivers that multiply or add up to it. Revenue = traffic x conversion rate x average order value, and each branch splits further, such as traffic by channel. When revenue drops, the tree shows which driver moved, so investigations are structured rather than random. It also links teams to the branch they own and helps choose leading indicators for a dashboard.
49

Business teams have built hundreds of their own reports, each with its own revenue logic. How do you balance self-service with governed dashboards?

Save to ▾
Show answer
A good model is a governed core plus self-service on top. The central team builds certified datasets with agreed metric definitions and a small set of official dashboards for key KPIs. Business users then build their own views on those certified datasets, not on raw extracts. This gives speed and flexibility without twenty versions of revenue. Training, naming conventions and periodic clean-up of unused content keep it healthy.
50

Your analysis shows that a flagship initiative championed by leadership is not working. How do you present it?

Save to ▾
Show answer
Prepare carefully and stay factual. Share the finding early with the initiative owner privately so they are not surprised in a big meeting. Lead with the question asked, the method and the evidence, acknowledge limitations and what is working, and avoid blaming anyone. Offer options, such as fixing a specific step, narrowing the scope or stopping, with estimated impact. Bad news delivered with solutions is received far better.
51

What is the pyramid principle and how does it apply to presenting analysis?

Save to ▾
Show answer
The pyramid principle means starting with the answer, then giving the few key arguments that support it, then the detailed data under each argument. Analysts are tempted to present in the order they worked, from data to conclusion, but leaders want the conclusion first. Example: we should cut the free-delivery threshold, because it lifts order frequency, margin impact is small and competitors already did it, each backed by evidence.
52

Leadership wants a single revenue number for next quarter, but your forecast is uncertain. How do you present it?

Save to ▾
Show answer
Show ranges, not just a single number: a forecast line with a shaded prediction interval, or a statement like revenue will likely be between 48 and 55 crore, most likely 51. Explain the main assumptions and what would change the outcome, perhaps with best, base and worst scenarios. Use plain words such as likely or unlikely consistently. Hiding uncertainty makes a forecast look precise but leads to bad decisions when reality differs.
53

A senior stakeholder insists the data supports their conclusion, but your analysis does not. How do you handle it?

Save to ▾
Show answer
Stay respectful and focus on evidence, not opinions. Ask what they are seeing that leads to their view, as they may know context you lack. Walk through your method transparently, show the specific numbers, and test their hypothesis together on a cut they suggest. If the data still disagrees, present both views with their assumptions to the decision maker. Never adjust the analysis to fit a preferred answer.
54

Describe a time you influenced a decision without having formal authority.

Save to ▾
Show answer
Situation: the marketing team planned to spend most of its budget on a channel with high clicks. Task: as the analyst, I believed the channel brought low-quality customers. Action: I built a cohort view showing 90-day repeat purchase and revenue per customer by channel, and walked the marketing lead through it before the planning meeting. Result: they shifted 30 percent of that budget to better channels, and the next quarter's cost per retained customer fell noticeably.
55

Tell me about a time you mentored or guided a junior analyst.

Save to ▾
Show answer
Situation: a new analyst on my team kept getting review comments for inconsistent numbers. Task: help him become independent. Action: I paired with him on two reports, shared a checklist covering definitions, row-count checks and chart standards, and set a weekly 30-minute review where he presented his work. Result: within six weeks his reports passed review with minor edits, and the checklist became part of team onboarding.
56

What is a junk dimension?

Save to ▾
Show answer
A junk dimension combines several low-cardinality flags and indicators, such as payment type, is_gift, is_express and order channel, into one small dimension table. Each row is a unique combination of those values, and the fact table stores a single key to it. This keeps the fact table narrow and avoids many tiny dimensions or loose flag columns. It works best when the combinations are limited, typically a few hundred rows.
57

What is a factless fact table? Give an example.

Save to ▾
Show answer
A factless fact table records that an event or relationship happened but has no numeric measures, only dimension keys. Examples are student attendance (student, class, date) or which products were on promotion in which store each day. You analyse it by counting rows. A promotion coverage table is useful for questions like which promoted products did not sell, by comparing it with the sales fact.
58

What are transaction, periodic snapshot and accumulating snapshot fact tables?

Save to ▾
Show answer
A transaction fact stores one row per event, such as each payment. A periodic snapshot stores the state at regular intervals, such as daily stock per store or month-end loan balance. An accumulating snapshot has one row per process instance, like an order, updated as it reaches milestones such as placed, packed, shipped and delivered, with a date for each. Choose based on whether the question is about events, states or process durations.
59

What is an enterprise bus matrix?

Save to ▾
Show answer
A bus matrix is a planning grid with business processes as rows, such as orders, shipments and returns, and conformed dimensions as columns, such as date, customer, product and warehouse. A tick shows which dimensions each process uses. It helps prioritise which fact tables to build, shows which dimensions must be shared and conformed first, and gives leaders a one-page roadmap of the warehouse without technical detail.
60

Write SQL to get each order's customer city as it was on the order date, using an SCD Type 2 customer dimension.

Save to ▾
Show answer
-- dim_customer has valid_from, valid_to (NULL for current row) SELECT o.order_id, o.order_date, c.customer_id, c.city FROM fact_orders o JOIN dim_customer c ON c.customer_id = o.customer_id AND o.order_date >= c.valid_from AND o.order_date < COALESCE(c.valid_to, DATE '9999-12-31');
61

What is a bridge table and when do you need one?

Save to ▾
Show answer
A bridge table resolves a many-to-many relationship between a fact and a dimension. For example, one bank account can have several holders and one customer can hold several accounts, so a bridge table stores account_key, customer_key and often an allocation weight. Without it, joining facts to customers duplicates amounts. Use weights to split balances, or report clearly that totals across customers will exceed the true total.
62

Write SQL to incrementally load new and changed products into a dimension using MERGE.

Save to ▾
Show answer
MERGE INTO dim_product t USING stg_product s ON t.product_id = s.product_id WHEN MATCHED AND (t.name <> s.name OR t.category <> s.category) THEN UPDATE SET name = s.name, category = s.category, updated_at = CURRENT_TIMESTAMP WHEN NOT MATCHED THEN INSERT (product_id, name, category, updated_at) VALUES (s.product_id, s.name, s.category, CURRENT_TIMESTAMP);
63

Leadership wants sales by store manager, but managers move between stores every few months. How would you model it?

Save to ▾
Show answer
First agree the business rule: should a sale belong to the manager in charge on the sale date, or to the current manager? For history, track the manager on the store dimension as SCD Type 2, or keep a separate store-manager assignment table with start and end dates and join on the sale date. Add a current-manager attribute too, so both views are possible. Document the rule on the report.
64

Actual sales are at order-line level but targets are set per region per month. How do you model them together?

Save to ▾
Show answer
Keep two fact tables at their natural grains: fact_sales at order line and fact_target at region-month. Never spread targets onto order lines. Both share conformed dimensions at a common level, such as a month attribute in the date dimension and region in the geography dimension. In reports, compare them only at month and region or higher. In Power BI, relate targets to month-level or region-level tables, not to daily keys.
65

Write a DAX measure that counts new customers, meaning customers who bought in the selected period but never before it.

Save to ▾
Show answer
New Customers = VAR PeriodStart = MIN ( 'Date'[Date] ) VAR CurrentCustomers = VALUES ( Sales[CustomerID] ) VAR PastCustomers = CALCULATETABLE ( VALUES ( Sales[CustomerID] ), 'Date'[Date] < PeriodStart, REMOVEFILTERS ( 'Date' ) ) RETURN COUNTROWS ( EXCEPT ( CurrentCustomers, PastCustomers ) )
66

What is the peeking problem in A/B testing?

Save to ▾
Show answer
Peeking means checking the p-value repeatedly during a test and stopping as soon as it drops below 0.05. Each look is another chance for random noise to look significant, so the real false positive rate can rise from 5% to 20% or more. Fix it by fixing the sample size in advance and analysing once, or by using methods built for continuous monitoring, such as sequential testing or always-valid confidence intervals.
67

Your 50/50 test has 52,400 users in control and 47,600 in treatment. What does this tell you?

Save to ▾
Show answer
This is a sample ratio mismatch. A chi-square test on these counts gives a tiny p-value, so the gap is not chance. Something is filtering users unevenly, such as the treatment page crashing on some devices, a redirect losing tracking, bots in one arm or a bug in assignment. The results cannot be trusted until the cause is found. Check splits by browser, platform and day to locate it.
68

Why is testing many metrics or many variants at once a problem, and how do you handle it?

Save to ▾
Show answer
Each comparison at alpha 0.05 has a 5% false positive chance, so checking 20 metrics will probably flag one as significant by luck. This is the multiple comparisons problem. Handle it by choosing one primary metric in advance, treating others as exploratory, and adjusting p-values with Bonferroni or Benjamini-Hochberg when several comparisons matter. With many variants, compare each to control and adjust, or use a larger sample.
69

Why are A/B tests tricky in two-sided marketplaces such as ride-hailing or food delivery?

Save to ▾
Show answer
In marketplaces, groups share supply, so the treatment can affect control. If treatment riders get a discount and book more, fewer drivers remain for control riders, which makes treatment look better than it would at full rollout. This violates the independence assumption. Teams use cluster randomisation by city or region, switchback tests that alternate treatment by time slots, or model the spillover when estimating impact.
70

An A/B test is flat overall but significant for mobile users in Tier 2 cities. Do you ship it only for that segment?

Save to ▾
Show answer
Not straight away. Slicing results into many segments makes a chance finding likely, so this is a hypothesis, not a conclusion. Check whether the segment was planned in advance, how many segments were examined, and whether there is a plausible reason, such as slower networks benefiting from a lighter page. If it still looks promising, run a follow-up test targeted at that segment with enough sample to confirm it.
71

What is the difference between frequentist and Bayesian A/B testing?

Save to ▾
Show answer
Frequentist testing asks how surprising the data would be if there were no difference, and gives p-values and confidence intervals with a fixed sample size. Bayesian testing combines a prior with the data to give a probability that treatment beats control and the expected loss of choosing it. Bayesian results are easier for business users to read, but still depend on priors and still need sensible stopping rules.
72

What is CUPED and how does it speed up experiments?

Save to ▾
Show answer
CUPED is a variance reduction method that uses each user's pre-experiment behaviour, such as spend in the previous four weeks, as a covariate. You adjust the outcome by removing the part explained by past behaviour, which is unrelated to the treatment because assignment was random. The lower variance gives tighter confidence intervals, so you can detect the same effect with fewer users or a shorter test, often 20-50% faster.
73

How do you measure impact when a proper A/B test is not possible?

Save to ▾
Show answer
Use quasi-experimental methods. Difference-in-differences compares the change in a treated group, such as cities that got a new policy, with the change in similar untreated cities over the same period. Synthetic control builds a weighted mix of untreated regions to mimic the treated one. Regression discontinuity uses a cut-off, like a credit score threshold. Always check pre-period trends and state the assumptions clearly.
74

Write Python code for a simple difference-in-differences estimate of a store pilot.

Save to ▾
Show answer
import pandas as pd # df columns: store_type ('pilot' or 'control'), period ('pre' or 'post'), sales avg = df.pivot_table(index='store_type', columns='period', values='sales', aggfunc='mean') pilot_change = avg.loc['pilot', 'post'] - avg.loc['pilot', 'pre'] control_change = avg.loc['control', 'post'] - avg.loc['control', 'pre'] did = pilot_change - control_change print(f'Estimated pilot effect per store: {did:.1f}')
75

Write Python code to bootstrap a 95% confidence interval for the difference in revenue per user between two groups.

Save to ▾
Show answer
import numpy as np rng = np.random.default_rng(42) control = df.loc[df.variant == 'A', 'revenue'].to_numpy() treat = df.loc[df.variant == 'B', 'revenue'].to_numpy() diffs = [] for _ in range(5000): c = rng.choice(control, size=len(control), replace=True) t = rng.choice(treat, size=len(treat), replace=True) diffs.append(t.mean() - c.mean()) low, high = np.percentile(diffs, [2.5, 97.5]) print(f'95% CI for difference: {low:.2f} to {high:.2f}')
76

Write SQL to calculate daily active users and the DAU/MAU stickiness ratio.

Save to ▾
Show answer
WITH dau AS ( SELECT CAST(event_ts AS DATE) AS day, COUNT(DISTINCT user_id) AS dau FROM events GROUP BY CAST(event_ts AS DATE) ) SELECT d.day, d.dau, (SELECT COUNT(DISTINCT e.user_id) FROM events e WHERE CAST(e.event_ts AS DATE) BETWEEN d.day - INTERVAL '29 days' AND d.day) AS mau, ROUND(100.0 * d.dau / (SELECT COUNT(DISTINCT e.user_id) FROM events e WHERE CAST(e.event_ts AS DATE) BETWEEN d.day - INTERVAL '29 days' AND d.day), 1) AS stickiness_pct FROM dau d ORDER BY d.day;
77

What is the difference between marketing mix modelling and multi-touch attribution?

Save to ▾
Show answer
Multi-touch attribution tracks individual user journeys and assigns credit to clicks and views, but it misses offline channels like TV and outdoor, and it is weakened by cookie loss and privacy rules. Marketing mix modelling uses aggregated weekly data, such as spend per channel, sales, price and seasonality, in a regression to estimate each channel's contribution and diminishing returns. MMM is better for budget planning; MTA is better for quick digital optimisation.
78

What is incrementality testing in marketing?

Save to ▾
Show answer
Incrementality testing measures sales that happened because of a campaign, compared with what would have happened anyway. You hold out a random group of users or a set of matched cities from the campaign and compare their conversions with the exposed group. Attribution tools often over-credit channels like retargeting and brand search, which reach people already likely to buy, so incrementality tests show the true lift and the true cost per incremental sale.
79

How do cookie restrictions, consent rules and server-side tagging affect web analytics data in 2026?

Save to ▾
Show answer
Browser tracking prevention, ad blockers and consent banners mean many visits are not fully tracked, so analytics undercounts users and conversions and breaks multi-session journeys. Under India's DPDP Act and similar laws, you need valid consent for non-essential tracking. Teams respond with consent mode modelling, first-party and server-side tagging, logged-in user IDs and reconciling analytics with backend orders, and they treat analytics numbers as estimates rather than exact counts.
80

Write SQL to group raw page events into sessions using a 30-minute inactivity rule.

Save to ▾
Show answer
WITH ordered AS ( SELECT user_id, event_ts, LAG(event_ts) OVER (PARTITION BY user_id ORDER BY event_ts) AS prev_ts FROM page_events ), flagged AS ( SELECT *, CASE WHEN prev_ts IS NULL OR event_ts - prev_ts > INTERVAL '30 minutes' THEN 1 ELSE 0 END AS new_session FROM ordered ) SELECT user_id, event_ts, SUM(new_session) OVER (PARTITION BY user_id ORDER BY event_ts) AS session_no FROM flagged;
81

After a website migration, the share of direct traffic jumped from 15% to 45%. What could cause it?

Save to ▾
Show answer
Direct is the default bucket when the source is unknown, so a jump usually means attribution broke. Common causes are redirects that strip UTM parameters, a new referrer policy hiding the referring site, the analytics tag missing on landing pages so sessions start later on the site, payment or login domains not added to the cross-domain or referral exclusion list, and HTTPS to HTTP transitions. Compare landing pages and campaign traffic before and after.
82

Brand keyword ads show a ROAS of 15, and the team wants to double the budget. How do you respond?

Save to ▾
Show answer
Brand search ROAS is usually inflated because people searching the brand name were already looking for you and would often click the free organic result anyway. Before increasing spend, I would propose an incrementality test, such as pausing brand ads in some matched cities or time periods and measuring the drop in total brand-search orders. The incremental ROAS is often far lower, so the extra budget may work better elsewhere.
83

The CMO asks which marketing channel should lose 20% of its budget. How do you approach it?

Save to ▾
Show answer
I would compare channels on incremental return, not last-click ROAS. Gather spend, attributed conversions under two models, customer quality such as repeat rate and margin, and any lift test or mix model results. Look at diminishing returns: the last rupee in a saturated channel is worth less than the average. Then recommend cutting where marginal return is lowest, ideally phased with a holdout to confirm the impact.
84

Describe a time you explained the limits of attribution data to a senior stakeholder.

Save to ▾
Show answer
Situation: a director wanted to cut social ads because last-click reports showed almost no sales. Task: give a fairer view. Action: I showed with simple path examples that social often started journeys that ended in search, compared first-click and data-driven views, and proposed a two-city holdout test. Result: the test showed meaningful incremental sales, so the budget was trimmed modestly instead of cut, and attribution caveats were added to the dashboard.
85

Tell me about a time you handled a request for access to sensitive data.

Save to ▾
Show answer
Situation: a regional manager asked for a salary-level export of all employees to plan hiring. Task: help without breaking data policy. Action: I clarified the actual need, which was headcount cost by grade and location, checked with HR on access rules, and built a Power BI view with aggregated costs and row-level security limiting each manager to their region. Result: the manager got what was needed and no individual salaries were exposed.

Frequently asked questions

Who should practise hard Data Analytics questions?

Candidates targeting senior roles or top product companies, and anyone who finds the medium set easy.

How should I practise these?

Answer each question aloud before opening the answer, mark it as solved only when your answer matches the key idea, and save misses to Last-Minute Revision.

Other difficulty levels