Ravindra BagaleCourses & study guides मराठी Track your progress

24. Power Pivot and the Data Model

Excel

24.7 DAX Measures: SUM, COUNTROWS, DISTINCTCOUNT and CALCULATE

1. Define four numbers the team can reuse

Imagine you are helping a campus grocery project prepare a report modeled on a quick-commerce app. The organizer wants sales by city, a count of orders and the number of people who bought something. A team member copies the city rows into a slide, adds up the customer counts and announces seven customers. The order register contains six customer IDs. Both numbers can be calculated from the same data. They answer different questions.

We will use the fictional FreshGo and MarketRush sample that runs through this chapter. Every approved row in Orders represents one order with one product, and Amount is the order amount in rupees. The city comes from Stores. The October and November intake checks give 12 approved rows and ₹2,315 across the full sample. Keep those two checks next to your notebook. You will return to them after building the measures and deliberately changing a practice copy.

Start with the question a number answers

  • How much money did the accepted order rows record? Add Amount. A person who places two real orders contributes both amounts. Deleting the second order would understate the result.
  • How many orders are present? Count rows while the declared grain is one row per order. If the grain changes to one row per order line, revisit this definition. Write the condition next to the count.
  • How many distinct customer IDs bought in the selection? Build a list of different IDs from the filtered orders, then count the list. A repeat buyer contributes several orders and one ID at this scope.
  • How much of the selected sales value came from Pune? Decide whether the report will keep or replace a current City selection. Define the numerator and denominator before choosing a function.

A measure stores one formula in the workbook’s Data Model. Tables, filters and relationships give it the set of rows to evaluate. A PivotTable can reuse the definition for each city, and a second report using the same model can use it for product categories. That helps the team keep one definition of sales. If the approved meaning later changes, you can review one definition and every report that depends on it instead of hunting through unrelated worksheet cells.

Read a number with its scope. “₹940 from Pune in the October and November practice sample” identifies the amount, the place and the period. “Sales ₹940” leaves the next person guessing which rows contributed.

2. Enter the definition where the Data Model can see it

Use a supported Windows desktop Power Pivot environment

Open a working copy of the workbook built in the previous lessons. Check that Orders, Stores, Products and Calendar appear in the Data Model. Use Stores[StoreID] on the unique side of the relationship to Orders[StoreID]. The date filter tests also need the earlier relationship from Calendar[Date] to Orders[Date]. If the Power Pivot authoring controls are unavailable in your platform, edition or organization, do the row tracing directly from the printed fixture. Continue the clicks later in a supported environment.

  1. Open Power Pivot › Calculations › Measures › New Measure in the Excel window. Choose Orders for the home table. That setting locates the definition in the field list and can help another analyst find it.
  2. Enter Total Sales in Measure Name. In the Formula box use =SUM(Orders[Amount]). If the equals sign is already present, type after it. Give a useful description if the dialog offers the field and check the formula.
  3. Select an appropriate numeric or currency category and review the rupee format available in your version. The currency display leaves the underlying arithmetic the same. Keep Amount numeric in the model. Avoid adding a rupee character to each imported source value.
  4. Repeat for Order Count and Customers. Use whole-number formatting because both measures count things. As you create later measures, create the base definitions first so a formula that refers to [Total Sales] can resolve it.
  5. Insert a PivotTable from the workbook Data Model. Add the three measures in Values, verify ₹2,315, 12 and 6, and then add Stores[City] in Rows. Repeat that baseline while building the layer above it.

The examples below use a label and a formula on one line, as you might document definitions or enter them in the Power Pivot Calculation Area. In the separate New Measure dialog, enter the name and expression in their separate fields. Use your Excel installation’s accepted argument separator for formulas that take several arguments. The code here uses commas. DAX functions in this section belong to model definitions, which you can then place in a PivotTable.

Total Sales := SUM(Orders[Amount])
Order Count := COUNTROWS(Orders)
Customers := DISTINCTCOUNT(Orders[CustomerID])
Sales per Order := DIVIDE([Total Sales], [Order Count])

Recognize the worksheet choices the field list offers

Dragging a raw numeric Amount field to Values can produce an implicit Sum of Amount. That works as an initial check. Explicit Total Sales gives the workbook a named definition you can reuse in another measure or model report. In this fixture, the implicit sum and the explicit sum agree. As definitions evolve, use the named measure wherever you intend the same business rule.

A calculated column answers a per-row question. For example, a controlled catalog cost model could add a value on each order using =Orders[Qty]*RELATED(Products[Price]) under the approved relationship and price assumptions. That calculated column has a value for every eligible order record. If source Amount already records the historical amount, preserve it. A current reference price might differ from the amount paid. A measure can add the approved recorded amounts for any selected collection of rows. Choose the column when a row-level value is required and the measure for a report-level result that needs to respond to selection.

3. Trace the measure from its report cell to the fact rows

Identify the filters first

The selected city is a value in a lookup table. The relationship turns that value into the matching store identifiers on the fact side. A row labeled Pune with no other selection reaches store BLK-PUN-01 in this sample. It admits O-101, O-104, O-106, O-107 and O-111. You can write their amounts out as 128, 220, 192, 270 and 130. They add to ₹940. Counting records gives five. Reading their customer IDs yields C01, C04, C01, C02 and C04, which produces three distinct IDs.

A measure in a PivotTable cell uses filter context, the constraints that determine the visible data for the expression. The context can come from a row or column label, a report filter, a connected slicer or the measure itself. In a City by Month matrix with November in the column and Pune in the row, both restrictions apply. November leaves O-107 and O-111 of the five Pune records. There you get ₹400, two orders and two customers. The same defined formula runs in the second context.

Row context is a separate DAX idea. One easy place to see it is a calculated column operating on the current source record. Many order rows can contribute to one PivotTable cell. Although you see a row label in the report, it supplies a city filter. To tell these cases apart, ask whether you are processing one current input record or evaluating an expression for a collection of filtered records.

Approved city totals across October and November 2026
CitySales ₹OrdersCustomers
Pune94053
Nashik67032
Nagpur35521
Solapur35021
Grand Total2315126

Recompute the total per measure

The Grand Total evaluates the formula over the total cell’s context. All four city amounts add to ₹2,315 in this display because every order’s money belongs to exactly one of those city rows. Every order row also appears in one city and contributes one to the count of 12. That addition works because the groups form disjoint pieces of the underlying order rows.

Customer IDs can cross those groups. Pune has C01, C02 and C04. Nashik has C02 and C06. Nagpur has C03. Solapur has C05. Base the total on the set C01 through C06. If you sum the city counts, C02 contributes twice. The sum of seven can describe city–customer memberships for the sample. Six describes distinct customer IDs across those cities. Tell the person reading the table which answer the report promises.

Pune has C01, C02 and C04. Nashik has C02 and C06. Together they have four distinct IDs because C02 appears in both.
Union means combining both ID lists and keeping each ID once. Pune and Nashik have four customers together. Adding Nagpur and Solapur brings the full model to six.

Use a merge of sets for overlapping periods too

October includes C01, C02, C03, C04 and C05. November includes C02, C03, C04, C05 and C06. Five plus five gives ten month–customer memberships. Four IDs are present in both lists, so the two-month distinct count is six. A subscriber activity report modeled on a streaming app would face the same issue when one member opens the app in two months. The metric needs to say whether it counts unique members across the quarter or monthly member activity summed across the quarter.

4. Decide how CALCULATE should change the selection

Keep the base measure simple, then choose the extra condition

You need one single-value report showing Pune sales across the selected period. Start from [Total Sales] and ask DAX to evaluate it with City equal to Pune. CALCULATE changes the filter context for that evaluation. It leaves the measure definition and source rows in place. When the condition targets a column already filtered, the plain condition can replace that column’s existing filter. For the isolated City selection below, a Nashik slicer does not stop the plain Pune measure from returning Pune rows.

Pune Sales := CALCULATE([Total Sales], Stores[City] = "Pune")
FreshGo Sales := CALCULATE([Total Sales], Stores[Platform] = "FreshGo")
Pune Sales Within Selection :=
    CALCULATE([Total Sales], KEEPFILTERS(Stores[City] = "Pune"))

KEEPFILTERS asks for the intersection on that field. Read it as Pune and the previously selected City values. With Nashik alone selected, the intersection contains no city. In this sample that gives an empty sum, displayed as blank under normal settings. With Pune plus Nashik selected, Pune remains eligible and the result uses those Pune rows only. Test the same three choices with a date slice to see that the date constraint continues to matter.

With Nashik selected, City replacement returns Pune amounts of 940 rupees. Keeping both conditions leaves no city and returns blank.
These two measures answer different questions under a Nashik-only City filter. Both tests start across the same two months, with all other filters clear.

Change one selection at a time and write a prediction

Measure outcomes with specified City and date filters
Report selectionTotal ₹Pune ₹Pune within ₹
All cities, both months2315940940
Nashik, both months670940Blank
Nashik, October180540Blank
Pune and Nashik, November890400400

The date filter affects a different table and column, so October remains relevant when City is replaced. Under a MarketRush-only Platform selection, forcing Pune in City still has to respect Platform. The approved Stores lookup places Pune in FreshGo. No store matches that intersection. This example also explains why a hard-coded city measure in a city-by-platform display can feel surprising. Keep diagnostic filters visible and use a title that tells readers what the measure enforces.

In a two-value report showing FreshGo Sales and Total Sales without any Platform row or slicer, you get ₹1,610 and ₹2,315. Adding Platform in Rows creates a Platform filter in each row. The explicit FreshGo formula can replace the current filter on that same column. For the ordinary platform breakdown, use Total Sales in Values and Platform in Rows. That produces ₹1,610 for FreshGo and ₹705 for MarketRush. Keep the dedicated FreshGo measure for the question that explicitly needs it.

5. Name both sides of a ratio

Keep the ratio with the report that supplies its scope

Pune Share := DIVIDE([Pune Sales], [Total Sales])
Pune Share Within Selection :=
    DIVIDE([Pune Sales Within Selection], [Total Sales])

Across both months with every city included, Pune has ₹940 out of ₹2,315. The first definition gives about 40.6% at this scope. Excel’s percent format displays a proportion of about 0.406 as 40.6%. Decide whether you want one or two decimal places in the report. Keep the value unrounded for downstream calculations unless the reporting policy calls for a particular rounding rule.

Now select Nashik alone. The first formula still obtains ₹940 for Pune by replacing City in the numerator, while the denominator becomes ₹670 for the current selection. The result is about 140.3%. The division follows the formula exactly. This scope would make a poor card labeled Pune share of total market sales under a Nashik city selector. A clear choice is a period-filtered card with no City filter, or a measure and label that explicitly use the selection-preserving definition. Test the slicer connections to keep that behavior reproducible.

With Pune alone selected, the selection-preserving share is 100%. The same ₹940 sits above and below the fraction. With Nashik alone selected, the numerator is blank because Pune is excluded. In this training report blank means the slice provides no matching Pune order. If a business instead wants a displayed zero share when the denominator records positive market sales and the source confirms zero Pune sales, write that rule separately and test both reported absence and true zero. Avoid replacing unknown with zero across the entire model.

Recompute the total average using the total denominator

Sales per Order gives ₹192.92 at the two-month grand total using ₹2,315 divided by 12. A city row such as Pune gives ₹188 using ₹940 divided by five. Averaging the four displayed averages gives each city equal weight even though one city has five orders and another has two. That describes the average of city averages. The amount per order for the whole report needs each order to carry equal weight, which comes from the overall numerator and denominator in that context.

DIVIDE returns a blank by default when division has a zero or blank denominator. An optional constant alternate result is available if your metric defines a different behavior. First pick the reason a denominator can be empty. In the sample, the absence of December orders leaves no meaningful sales per order. A coverage note can distinguish a December period awaiting a source file from an approved December receipt with no transactions. The actual ratio remains undefined in both cases, since there were no orders to average in the data under evaluation.

6. Predict the next cell

Follow the model from all cities to one city in November

  1. Start with the approved two months

    No city filter is active. The table admits 12 rows and sums to ₹2,315. It contains six different customer IDs. Use these as the reference readings before changing a slicer.

  2. Select Pune

    The Stores lookup passes the Pune store key to Orders. The five matching rows total ₹940. Two customers appear twice. That explains why the customer count is three even with five order rows.

  3. Add November

    The remaining rows are O-107 and O-111. Together they amount to ₹400 and represent two different customers. The date relationship gives a second inclusion test for each row.

  4. Switch City to Nashik

    Current sales become ₹490. Plain Pune Sales returns ₹400 by changing City to Pune while keeping November. Pune Sales Within Selection gives blank, because the report now admits Nashik only.

7. Build a measure test and break a practice copy

Lab A — Reconcile the city and platform report

  1. Use the approved fixture copied from the three input tables in 24.1. Create the four basic measures in a supported Excel copy, and keep a paper version of the test with the OrderID and Amount for each row.
  2. Build a model PivotTable with City from Stores and the sales, order and customer measures. Compare each row with the city controls and trace O-102 and O-107. Both use C02, and the orders belong to different cities.
  3. Add Month from Calendar as a column or a filter, using the year-aware month value in the date table. Run the Pune path in the manual stepper. If every city shows the full ₹2,315, inspect the relationship from Stores to Orders and confirm that City comes from Stores.
  4. Build a second PivotTable from the same model with Platform in Rows. Run Total Sales and Customers. Expect FreshGo to show ₹1,610 and four customers, and MarketRush ₹705 and two customers. Confirm that these two customer sets happen to be disjoint in this example.
  5. Create the plain and selection-preserving Pune measures. With no other filters, select Nashik and explain the difference. Then select October, check ordinary sales ₹180 and forced Pune ₹540, and clear both filters to return to ₹2,315.

Evidence to save. Write the row label, selected Month, exact measures used, expected values and observed values. Record the named source tables and refresh date. Include one case where two correct formulas give different answers because they implement different scope rules. The evidence lets a teammate reproduce each result without assuming your default settings.

Lab B — Separate duplicate imports from legitimate order lines

  1. Save a disposable copy and duplicate the complete O-101 record. Refresh the model copy from its actual table or query source. This sample’s grain makes repeated O-101 illegal. Predict sales, order rows, distinct order IDs and distinct customers before you look.
  2. Use a temporary Distinct Order IDs := DISTINCTCOUNT(Orders[OrderID]) definition as an additional check. Expect 13 fact rows, 12 distinct order IDs, six customer IDs and ₹2,443. One repeated row changed money and row count while two distinct counts stayed constant.
  3. Restore the clean copy. In a new scratch-only thought experiment or separate copy, redesign the source record as two approved O-101 lines for ₹32 and ₹96, with line quantities one and three and separate stable line identifiers. Use a field or checked composite business key that identifies each line. The sample is line-grain after this change.
  4. Expect 13 rows, 12 distinct order IDs and ₹2,315 in the line-grain example. Rename the temporary row count Order Lines. Treat the distinct order IDs as an order count after verifying that those IDs are present and unique to each order in the business scope.
  5. Write why both cases contain 13 rows and 12 order IDs. Use the approved source totals and the declared grain to decide which scenario is a problem. Then close the practice copies and return to the baseline file.

Evidence to save. Report the extra ₹128 under the duplicate test and zero sales difference under the line test. If a reviewer sees only distinct orders, both look normal. Present the row-grain check and amount tie-out together before handing off the model.

8. Distinguish a missing ID from an empty slice

An accepted purchase can have no customer identity

Some systems legitimately record guest orders. Other systems promise a customer ID on every accepted row. In the first case you may count identified customers and report guest orders separately. In the second case a missing ID fails an input requirement. Work out which rule applies before changing the formula. A blank ID and a literal text label such as “Guest” both deserve an explicit policy: dozens of unrelated people can share that label.

Take the approved sample and imagine that only O-112 arrives with CustomerID blank. Keep the order, amount and place unchanged for this hypothetical. Nashik stores three order rows and records ₹670 just as before. The city’s IDs are C02, C06 and blank. A distinct count over that column includes the blank value, giving three distinct values, with two known IDs. Across all cities, C06 still appears on O-108, so the original six known IDs remain. The ordinary distinct count increases to seven because its input also includes blank.

Known Customer IDs :=
    COUNTROWS(
        FILTER(VALUES(Orders[CustomerID]), NOT(ISBLANK(Orders[CustomerID])))
    )

Orders With Missing ID :=
    COUNTROWS(FILTER(Orders, ISBLANK(Orders[CustomerID])))

Read the inner expression first. VALUES supplies the current set of values from that column. FILTER applies the test to each of those values. The remaining table contains only known IDs within that report scope. COUNTROWS counts that result. The second measure filters the order rows directly and counts each row lacking an ID. If three guest orders all have blanks, the first measure excludes the blank distinct value once, while the second can report three order rows that lack an ID. If there are no qualifying rows, the result can be blank. Specify whether the report should show zero for an audited completeness check.

Find the difference in the source before editing the report

  • Blank from no matching rows. If you select December in this October–November exercise, there are no matching sales facts. COUNTROWS and DISTINCTCOUNT return blank for no rows. A PivotTable can hide an item with no data or display a configured symbol. Inspect the model and report settings when the displayed result is unclear.
  • Blank inside an existing row. The hypothetical O-112 has amount, date and store. Its missing customer ID still changes the set offered to the ordinary distinct count. Inspect the actual column and source rule to determine whether you can repair or must flag it.
  • Text that looks blank. An ID consisting of spaces or an imported placeholder such as “N/A” may be text in the model. Check the Power Query type and normalization rules. Retain the raw field and test any correction against source IDs so that meaningful markers are preserved or quarantined according to the source agreement.
  • An explicit zero amount. In a separate hypothetical, a confirmed no-charge order with an approved zero amount can contribute one order and a customer ID with zero money. The zero is a recorded numeric value. Check whether no-charge orders are included in sales-per-order or tracked apart under the business definition.

For a healthy baseline the missing-ID count can be blank because the filtered table of missing IDs is empty. A dashboard can show “0 missing IDs” when the approved file coverage has first been established and the measure definition intentionally presents that result. Across an unreceived month, the source status still needs to say that data is unavailable. A repeatable report separates file arrival, source rows, recorded value and missing identifiers. One display setting cannot convey all four.

9. Test a measure before somebody depends on it

Write a short definition card for each metric

Use an ordinary worksheet as a metric register. Write one row for every measure you use on the published report. Give each measure a reader-friendly caption, the table and field it uses, the intended unit and the scope. Explain whether it should respect all filters from the view, or replace one explicitly. Include how to interpret a blank, and who owns the definition. A teammate can then compare the saved measure with its business meaning during a review.

Examples of measure descriptions to save with the workbook
Saved measureWhat to record for a reviewer
Total SalesSum the received numeric Amount of approved orders in the current scope. Report in rupees. Confirm scope and approved file coverage upstream.
Order CountCount accepted fact rows. Valid as order count under the checked condition that the source contains one row per OrderID.
CustomersCount distinct CustomerID values appearing in filtered Orders. Original sample has complete IDs. Define guest treatment before publishing this as a count of people.
Pune SalesSet the City column to Pune when evaluating Total Sales. Period remains a constraint. Use the named comparison only in an approved layout.
Sales per OrderDivide current sales by current approved order count. Display in rupees per order, with blank when no meaningful denominator exists.

One number can pass a baseline accidentally. For example, a measure hard-coded as 2315 passes the all-city result once. It fails when you filter to Nashik or add a new file. A reviewer should run a positive case with recorded sales, a case with no matching rows and a case where the competing definitions produce different results. For this model, November in Pune, December across cities, and Nashik with the two Pune measures form that three-part check.

Keep each verification answer traceable

  • Prove the approved scope independently. The input receipt records two approved files and 12 source rows. If the report total changes, check the connected query/folder listing before debating the DAX. An October-only result of ₹1,005 may be a genuinely selected October or a missing November source. See the report filter and intake audit together.
  • Use the smallest failure slice. If the approved value differs only in Pune, list the five expected OrderIDs and look for extras and omissions. A duplicate or product filter changes the contributing records. The individual amounts provide a stronger clue than staring at the model total.
  • Check the source type and units. Ensure imported Amount is numeric and defined consistently across the files. If the producer changes the field to paise, a total dominated by a 100-times change needs a unit correction at intake. Applying an attractive currency format would leave the scale problem intact.
  • Check field origin. Use City from Stores, the stable date label from Calendar and the saved measure from the model. If a second PivotTable was accidentally built from a worksheet table, it may offer Amount and City as similar-looking labels while working with a different source.
  • Compare each sales slice after restoring filters. Remove the date or city filter you changed and rerun the baseline. Record the active filters as part of any saved evidence so the next person can repeat the experiment exactly.

Follow a discrepancy instead of layering another calculation onto it

Your teammate sees exactly ₹2,315 on each line of a report labeled Pune, Nashik, Nagpur and Solapur. A plausible cause is missing or ineffective filtering between Stores and Orders. Confirm that the report comes from the correct Data Model, that your City field belongs to the appropriate lookup, and that its StoreID relationship is active. Use the approved known rows for one store as the test. If the problem appears only in a measure that forced City, review its filter rule too. A plain city-specific CALCULATE can repeat the Pune amount across several city labels even while the relationship works normally. Putting the unmodified Total Sales alongside it separates these two cases.

Suppose the report shows ₹2,443 and 13 orders after refresh, while the customer result stays at six. Check the file intake and repeated OrderIDs. The difference of ₹128 points to a possible O-101 repeat in this small sample. In a real report, several distinct data issues can yield the same amount, so inspect identifiers and input provenance before deciding what happened. A calculation that always shows six customers is weak evidence for the health of the imported sales table. Preserve the raw batch and rerun the receipt check after fixing the accepted query filter.

Suppose ordinary sales in a positive cell match the manual total but the count of customer IDs exceeds your list of named customers. Inspect whether the column contains a blank or placeholder and whether the business uses anonymous orders. For the fictional original source with complete data, a correct count also needs IDs stable across stores. If two stores give unrelated people the same local ID, a full-model distinct count undercounts people. Choose an identifier that uniquely represents the intended entity across the current scope, or explicitly label the measure as a count of source-system IDs. Adding a city prefix to every ID may then inflate the count for a real person who buys in two cities. Resolve the identity rule with the data owner rather than trying alternate formulas until the total looks familiar.

Decide how the reader should interpret a total

In the platform report the customer counts happen to add to six, because the four FreshGo IDs and the two MarketRush IDs are disjoint in this fixture. In the city report the rows sum to seven. A team might think that one table proves distinct counts always sum or that the other table exposes an Excel flaw. The two tables provide a better lesson together: check for overlap at the exact grouping axis being displayed. Next month’s customer mix could make the platform rows overlap even if all formulas remain the same.

Read an average in the same way. In our city report the four amounts per order are 188.00, 223.33, 177.50 and 175.00 rupees. Using the unrounded values, their simple average rounds to 190.96. The overall sales per order rounds to 192.92. Both arithmetic paths use correct inputs. The overall answer counts twelve orders in the denominator and gives each order equal weight. The average of city averages divides four cities into equal weights. Ask whether the decision is about the average order or the average city. State the denominator and unit in the caption, particularly when the result will be copied to a slide without the PivotTable.

10. Check your reasoning, then explain it aloud

Quick checks

1. C02 appears in Nashik and Pune. How many times does C02 contribute to the combined distinct total?

Once. Each city can count C02 in its own list. The combined result evaluates the set of customer IDs across its combined scope, so it includes that identifier only once.

2. With only Nashik selected, which Pune measure gives ₹940?

The plain City equals Pune measure returns ₹940 across both months because it replaces the existing filter on City. The measure using KEEPFILTERS leaves both City conditions applied and returns blank for the empty intersection.

3. After duplicating O-101, can a distinct order count of 12 verify sales?

No. The distinct count still recognizes twelve IDs and the order rows now contain ₹2,443. Sum the amount and audit rows against the accepted source. Those tests expose the additional ₹128.

4. Why does Pune’s November sales per order use 2 rather than 5?

November is a second constraint. Only O-107 and O-111 are visible for Pune in that context, so the result is ₹400 divided by 2, or ₹200. Five is the number of Pune orders for the two months combined.

5. How can three distinct values in the Nashik CustomerID column describe two known customers?

If O-112 has a blank ID, the column slice contains C02, C06 and blank. Ordinary DISTINCTCOUNT includes the blank as one distinct value. Filter blank from the ID set to count the two known IDs and report the missing row separately.

Interview practice

1. When would you replace a PivotTable’s default Sum of Amount with an explicit measure?

When the sum is a business definition that several reports or other measures need to use. An explicit Total Sales measure gives those consumers a durable name and a single definition. A default sum still makes a useful independent check against the initial model.

2. How would you explain filter context using one meaningful cell?

Point to Pune in Rows and November in Columns. The city relationship restricts the contributing store and the date relationship restricts the dates. Total Sales then evaluates on O-107 and O-111, returning ₹400. At the grand total the context is broader and the same expression returns ₹2,315.

3. A stakeholder says Pune accounts for 140.3% of market sales. What is your first check?

Read the measure definitions and the active City filter. A dedicated formula for Pune can force ₹940 in the numerator while Nashik selection leaves ₹670 in the denominator. The division is mathematically valid. The card title and context fail to describe the intended ratio. Decide the approved market denominator and test the displayed scope.

4. How do you distinguish filter context from row context for someone learning Excel?

In a calculated column, you can compute a particular order’s quantity times its relevant price while evaluating that record. In a measure placed by city and month, several order records can be eligible and the expression evaluates for their combined scope. Demonstrate by changing a PivotTable month without changing the source row.

5. What should change when a file begins reporting separate lines per order?

Define a stable line identifier, reconcile money at line grain, and rename the row-count measure to lines. A separate distinct order measure can count order IDs once when they are complete and correctly scoped. Rerun customer identity and measurement checks, since reports may previously have assumed a single product per order.

Six revision cards

  • One expression, several contexts. Define Total Sales once, then let City, Month and report filters select the contributing orders.
  • Count the correct grain. COUNTROWS counts records. Write the condition under which each record represents exactly one order.
  • Distinct totals use a union. Group memberships may overlap. Combine the eligible ID sets and count each identifier once at total scope.
  • Choose the City behavior. Plain CALCULATE can replace that field. KEEPFILTERS keeps the intersection on it.
  • Read the fraction in words. Use both the numerator scope and the denominator scope. Repeat the check after adding slicers.
  • Keep receipt evidence. Correct formulas cannot identify all duplicate or missing data from a single aggregate. Verify files, keys and amounts.

Compare the original DAX measures worksheet illustration with your city report. For a separate dataset, find more exercises in the Excel Practice Task Hub. Continue with prior-period comparisons using the date table or explore the Power BI DAX chapter.