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

How to Show Revenue, Sales and Orders in One Chart with Field Parameters in Power BI

Revenue by category, sales by category, orders by category: three charts that look almost the same and eat half the page. A cleaner page has one chart and three buttons above it: click Revenue, Sales or Orders and the chart switches. Power BI builds this with two things you already have, measures, and one new thing, a field parameter. In this chapter you first see why measures are worth writing (they are reusable), then build the three measures, the parameter and the button slicer, and finish with the slicer settings that keep the chart readable.

What you'll learn in this chapter

  • Three benefits of measures, and reusing one inside another
  • Total orders with DISTINCTCOUNT, not SUM
  • Modeling › New parameter › Fields
  • The parameter table: NAMEOF and the order number
  • Parameter on the Y-axis; legend when nothing is selected
  • Slicer Selection and Style options

Practice file: blinkit-sales-2025-metrics.csv (800 order lines, 496 orders).

Made-up data: fictional Blinkit-style sales, for practice only. Amounts are in ₹ and dates are DD-MM-YYYY.

1. The problem

The manager wants revenue, units sold and number of orders by category. Three column charts side by side take half the page and repeat the same axis three times. You want one chart that shows whichever metric the viewer picks.

Before: three chartsRevenue by categorySales by categoryOrders by categoryAfter: one chart, three buttonsRevenueSalesOrdersOne column chart: category on X, metric on YIllustration (fictional data)

Figure 1. Three charts take half the page; one chart with three buttons shows the same information (illustration).

Classroom line

On this one column chart I want to see revenue, sales and the number of orders.

2. The idea in simple words

Measures first. A measure is worth writing because:

  1. it aggregates: SUM, MAX, MIN, AVERAGE, COUNT;
  2. it can drive formatting through fx: colour, text, transparency;
  3. it is reusable: write it once, use it in any number of visuals and inside other measures.

Measures are calculated when a visual asks for them and add no stored data, so they keep the model small. Reuse in practice:

total revenue = SUM(sales[revenue]) total expense = SUM(sales[expense]) total profit = [total revenue] - [total expense]

Then a field parameter. A field parameter is a small table of choices (Revenue, Sales, Orders), each pointing to a measure. Put it on a slicer and on the chart's Y-axis, and the slicer decides which measure the chart shows.

Classroom line

Third, a measure is reusable. Once you create it, you can use it in any number of visuals.

3. The data

blinkit-sales-2025-metrics.csv: order_id (text, e.g. BO-10001), order_date, product_id, category, city, state, sales (units), revenue (₹), expense (₹). One order can have up to three lines.

Category Revenue (₹) Sales (units) Orders
Dairy & Bakery 59,124 474 214
Snacks & Branded Foods 35,200 592 281
Staples 30,290 176 94
Beverages 23,607 189 99
Total 1,48,221 1,431 496

The orders column does not add up to 496: an order with dairy and snacks counts once in each category, but once in the total. Expense totals ₹1,05,739, so total profit is ₹42,482.

4. Step by step

Three measures

  1. Load the file and rename the table sales.
  2. Three dots on sales › New measure, three times:
  3. total revenue = SUM(sales[revenue])
  4. total sales = SUM(sales[sales])
  5. total orders = DISTINCTCOUNT(sales[order_id])

The field parameter

  1. Modeling › New parameter › Fields.
  2. Name: Metric Selector. In the field list, open sales and tick total revenue, total sales and total orders, in the order you want the buttons.
  3. Keep Add slicer to this page ticked › Create. A table Metric Selector and a slicer appear.
  4. Click the Metric Selector table to see its DAX:

Metric Selector = { ("total revenue", NAMEOF('sales'[total revenue]), 0), ("total sales", NAMEOF('sales'[total sales]), 1), ("total orders", NAMEOF('sales'[total orders]), 2) }

The first value is the button text, NAMEOF points to the measure, the number is the button order. Change the texts to "Revenue", "Sales" and "Orders" and press Enter.

Chart and slicer

  1. Add a Stacked column chart: X-axis category, Y-axis Metric Selector (the parameter field, not a measure).
  2. Select the slicer › Format visual › Slicer settings › Options › Style Tile. Values: bold, 10.5 pt.
  3. Slicer settings › Selection › Single select on.
  4. Click Revenue, Sales, Orders: the chart switches metric each time.
3 measures: total revenue, total sales, total ordersModeling › New parameter › Fields: tick the 3 measuresTable "Metric Selector" + slicer (Tile, Single select)Column chart: category on X, Metric Selector on YClick a button: the chart switches metricIllustration (fictional data)

Figure 2. Measures, then a field parameter, then a slicer and a chart (illustration).

Classroom line

To show several metrics on one visual, we will use measures plus parameters.

Classroom line

What is a parameter? It is like a table.

5. Your result should look like this

Metric Selector = Revenue: total revenue by category (₹)59,124Dairy & Bakery35,200Snacks & Branded Foods30,290Staples23,607BeveragesIllustration (fictional data)

Figure 3. With Revenue selected: Dairy & Bakery ₹59,124, Snacks & Branded Foods ₹35,200, Staples ₹30,290, Beverages ₹23,607 (illustration).

Button Highest category Value
Revenue Dairy & Bakery ₹59,124
Sales Snacks & Branded Foods 592 units
Orders Snacks & Branded Foods 281 orders

6. What happened

  • The field parameter is a table whose rows point to measures. The slicer filters that table to one row.
  • The chart's Y-axis follows the selected row and shows that measure.
  • With nothing selected, all three measures appear together with a legend telling them apart.
  • Single select prevents that mixed view, where revenue in thousands of ₹ would flatten orders in the hundreds.

Classroom line

So what did we do? First, we made three measures.

7. Explore further

  • Any visual. A bar chart, line chart or pie chart takes the parameter in the same way.
  • Selection options. Single select: one at a time. With it off, Multi-select with CTRL lets viewers pick several; Show "Select all" adds a select-all button.
  • Style options. Tile (compact buttons for the top of a page), Dropdown or Vertical list.
  • Gridlines. Whether the chart shows gridlines depends on the report theme; turn them on or off under Format › X-axis / Y-axis › Gridlines.
  • Edit instead of tick. If you created the parameter from columns, edit the NAMEOF references to point to the measures; ticking the measures in the dialog avoids the edit.
  • Field parameters for the axis too. The main course lessons Field Parameters – Switch Measures and Field Parameters – Switch Dimensions (Dynamic Axis) go further.

Classroom line

Take any visual: a bar chart or a pie chart.

8. Common mistakes

Wrong result Reason Fix
SUM(order_id) gives an error order_id is text DISTINCTCOUNT(sales[order_id])
Total orders shows 800 COUNT counts lines, not orders DISTINCTCOUNT gives 496
Chart shows one bar per metric Parameter put on X-axis Category on X, Metric Selector on Y
Revenue and orders on one axis, orders look flat Several buttons selected Selection › Single select
Table named "Parameter 2" Default name kept Give it a unique name: Metric Selector
Button reads "order id" Text not changed Edit the first value in the DAX to "Orders"

Ravindra Bagale's Tip

Name the parameter for what it does: Metric Selector, not Parameter. When the model has three parameters, a name tells you at once which slicer drives which chart.

Classroom line

The order id's data type is text, so it needs a count.

9. Practise on your own

Practice task

Using blinkit-sales-2025-metrics.csv:

  1. Create total expense and total profit (reusing the measures). What is total profit?
  2. Add total profit to Metric Selector as a fourth button. Which category has the highest profit?
  3. What does COUNT(sales[order_id]) return, and why is it different from total orders?
  4. With Orders selected, what is the bar for Staples?
Show solution
  1. total expense = SUM(sales[expense]), total profit = [total revenue] - [total expense] = ₹42,482.
  2. Add ("Profit", NAMEOF('sales'[total profit]), 3). Dairy & Bakery: ₹59,124 − ₹42,229 = ₹16,895.
  3. 800: it counts order lines; an order can have up to three lines. DISTINCTCOUNT counts each order once: 496.
  4. 94.

10. Think like a professional

  • Business view. One switchable chart keeps the page calm and leaves space for other questions.
  • Right count. Decide whether you are counting lines or orders; on line-level data, orders need DISTINCTCOUNT.
  • Names users see. Button texts are labels for people: Revenue, Sales, Orders, not measure names.
  • One scale at a time. Metrics with different units belong on separate selections.

Interview questions

  1. What is a field parameter? A table of choices that point to fields or measures; a slicer on it changes what a visual shows.
  2. What is the third value in the parameter DAX? The order of the choices.
  3. How do you count orders on line-level data? DISTINCTCOUNT(sales[order_id]).
  4. Why use single select on a metric slicer? Different metrics have different scales; mixing them on one axis misleads.

Recap

In short

  1. Measures aggregate, drive fx formatting and are reusable: total profit = [total revenue] − [total expense].
  2. total orders = DISTINCTCOUNT(sales[order_id]).
  3. Modeling › New parameter › Fields › tick the measures › name it Metric Selector.
  4. Category on X, the parameter on Y.
  5. Slicer: Tile style, Single select.

Ravi Sir's Cards for this lesson

मराठी cards