Lesson 13 of 16 · Level 4: Expert
Income Statement (P&L) in Power BI with DAX
- ⏱ 13 min read
- ❓ 4 review questions
- ✍️ Exercise with solution
- 📥 Downloadable template
In this lesson
- Build an income statement (P&L) in Power BI with lines in accounting order.
- Combine sales from the model with an expenses table.
- Write one SWITCH measure that calculates every line, subtotal and percent of sales.
- Give a matrix professional financial formatting.
- Calculate the break-even point and read a two-month P&L to spot a loss.
We keep using the Summit Supply model from the rest of the course.
- summit-sales-power-bi.xlsx · sales, products, customers, sales reps and targets
Welcome to Level 4: Expert. You've finished and published a complete sales dashboard. Now you'll build the reports finance teams and executives ask for most, connect Power BI to real databases, run advanced customer and product analysis, and prepare for the official certification. We start with the report every owner and CFO wants to see: the income statement, or P&L (profit and loss).
The technical challenge is interesting: an income statement isn't a list of categories that add up. It has lines that come from different tables (sales, cost of goods sold, expenses), subtotals that subtract, and a fixed order. A regular matrix can't do that. You'll solve it with a technique professionals use all the time: a layout table and a measure built on SWITCH.
Step 1: the expenses table
The practice file has sales and product costs, but no operating expenses. Create them with Home › Enter data (at a real company they'd come from QuickBooks, your ERP or a finance spreadsheet):
| Date | Account | Amount |
|---|---|---|
| 1/1/2025 | Payroll | 3150 |
| 1/1/2025 | Rent | 1350 |
| 1/1/2025 | Delivery | 1125 |
| 1/1/2025 | Other expenses | 450 |
Name it Expenses, make sure Date is a Date type and Amount a Decimal Number, and relate Expenses[Date] to 'Calendar'[Date] (Lesson 8). That way expenses respond to the same date filters as sales. Add more months in the same format whenever you like.
Create the base measure:
Operating Expenses = SUM ( Expenses[Amount] )
Step 2: the P&L layout table
This table defines the report's rows, in order. Create it with Enter data too and name it P&L Lines:
| Order | Line | Type |
|---|---|---|
| 1 | Sales | Revenue |
| 2 | Cost of goods sold | Cost |
| 3 | Gross profit | Subtotal |
| 4 | Payroll | Expense |
| 5 | Rent | Expense |
| 6 | Delivery | Expense |
| 7 | Other expenses | Expense |
| 8 | Total operating expenses | Subtotal |
| 9 | Operating income | Subtotal |
Two important details:
- Select the Line column and, under Column tools › Sort by column, choose Order. Otherwise the matrix would list the lines alphabetically.
- Don't relate this table to any other. The measure will read which line is being displayed and decide what to calculate.
1. Why do you sort the Line column by the Order column?
Text sorts alphabetically by default: "Delivery" would come before "Sales". Sorting by another column locks in the order you define.
Step 3: the measure that calculates every line
P&L Amount =
VAR SelectedLine = SELECTEDVALUE ( 'P&L Lines'[Line] )
VAR LineType = SELECTEDVALUE ( 'P&L Lines'[Type] )
RETURN
SWITCH (
TRUE (),
SelectedLine = "Sales", [Total Sales],
SelectedLine = "Cost of goods sold", - [Total Cost],
SelectedLine = "Gross profit", [Gross Profit],
LineType = "Expense", - CALCULATE ( [Operating Expenses], Expenses[Account] = SelectedLine ),
SelectedLine = "Total operating expenses", - [Operating Expenses],
SelectedLine = "Operating income", [Gross Profit] - [Operating Expenses]
)
How it works:
SELECTEDVALUEreturns the line of the row the matrix is calculating (or blank if there are several, as on the total row).SWITCH ( TRUE (), condition, result, … )checks the conditions in order and returns the result of the first one that's true. It's the clean way to write a stack of nested IFs.- Costs and expenses show as negative numbers, as in a formal income statement, so reading top to bottom "adds up" on its own.
- The four expense lines share one rule: they filter Expenses to the account with the same name as the line. If you add "Marketing" tomorrow, you just add one row to each table.
And percent of sales, which is how a P&L is analyzed (the income statement lesson in our bookkeeping course explains why):
% of Sales = DIVIDE ( [P&L Amount], [Total Sales] )
Because P&L Lines isn't related to Sales, [Total Sales] doesn't change from line to line: it's always the period's total sales, exactly the denominator you need.
2. What does SELECTEDVALUE ( 'P&L Lines'[Line] ) return on the matrix's total row?
SELECTEDVALUE only returns a value when exactly one is in context. On the total, no SWITCH condition is met, so the measure is blank. That's why you should turn off row totals in this matrix.
Step 4: the matrix
- VisualizationsInsert a matrixThe visual that supports rows, columns and multiple values.
- Matrix fieldsRows, columns and valuesRows:
'P&L Lines'[Line]. Columns: year and month from'Calendar'. Values:P&L Amountand% of Sales. - Format › Row subtotalsTurn off subtotalsYour subtotals are already lines in the layout; the matrix's own would come out blank or duplicated.
- Filters paneFilter to January 2025Check every line against the table below before moving on.
| Line | Jan 2025 | % of sales |
|---|---|---|
| Sales | 21,989.03 | 100.0% |
| Cost of goods sold | -15,350.10 | -69.8% |
| Gross profit | 6,638.93 | 30.2% |
| Payroll | -3,150.00 | -14.3% |
| Rent | -1,350.00 | -6.1% |
| Delivery | -1,125.00 | -5.1% |
| Other expenses | -450.00 | -2.0% |
| Total operating expenses | -6,075.00 | -27.6% |
| Operating income | 563.93 | 2.6% |
The business read: the distributor has a healthy 30% gross margin, but expenses swallow nearly all of it, leaving an operating margin of just 2.6%. A small dip in sales or a jump in fuel costs would push it into a loss. That's what makes a P&L in Power BI so valuable: add a region or sales rep slicer and you'll see which part of the business carries the rest.
- Sales $21,989.03Includes the $405.00 sale with code P99.
- Cost of goods sold −$15,350.1069.8% of sales.
- Gross profit $6,638.9330.2% of sales.
- Operating expenses −$6,075.00Payroll, rent, delivery and other.
- Operating income $563.932.6% of sales.
Power BI has a native waterfall chart. If you use it with 'P&L Lines'[Line] as the category and P&L Amount as the value, filter the visual to exclude lines of type Subtotal: the waterfall calculates the running total itself, and if you leave the subtotals in, it counts them twice.
Break-even: how much you need to sell to avoid a loss
With gross margin as a percentage and fixed expenses, one measure answers the question every owner asks:
Break-even Sales =
DIVIDE ( [Operating Expenses], [Gross Margin %] )
Margin of Safety % =
DIVIDE ( [Total Sales] - [Break-even Sales], [Total Sales] )
For January 2025: $6,075 ÷ 0.30192 (the exact margin) = $20,121. Summit sold $21,989, so its margin of safety was just 8.5%: if sales had dropped a little more than 8%, the month would have closed at a loss. With this measure in a card, the owner knows every month how far above (or below) break-even the business is. It assumes gross margin % and expenses don't change with sales volume.
3. A distributor has a 30% gross margin and $6,000 a month in operating expenses. How much must it sell for operating income to be zero?
Break-even sales = expenses ÷ gross margin % = 6,000 ÷ 0.30 = $20,000. At that level, gross profit (20,000 × 30% = 6,000) covers expenses exactly.
Step 5: financial formatting
- Number format with thousands separators and two decimals; show negatives with a minus sign or in parentheses, following your company's standard.
- Highlight subtotals: conditional formatting can't make text bold, but it can add a light background color. Create a measure
Is Subtotal = IF ( SELECTEDVALUE ( 'P&L Lines'[Type] ) = "Subtotal", 1, 0 )and use it in Background color › Field value or with rules. - Color on the %: red when operating income is negative, with a conditional formatting rule.
- Add a vs. prior month or vs. budget column using the time intelligence techniques from Lesson 8.
A Power BI P&L that doesn't match the official financial statements loses leadership's trust in a day. Before publishing, compare a closed month with your accounting system's report and explain any difference (for example, the 3 sales with code P99 from Lesson 5, which have no cost).
4. You want to add a "Marketing" line to the P&L. What do you change?
The Type = "Expense" rule already covers any expense account whose name matches the line. That's the payoff of separating the layout from the calculations.
Practice exercise: extend your P&L
- Add February 2025 expenses (payroll 3,150, rent 1,350, delivery 1,240, other 410) and check the matrix with two months.
- Add a "Depreciation" line (a $225 monthly expense) and an "EBITDA" line before it, equal to gross profit minus the expenses that aren't depreciation.
- Create the
Is Subtotalmeasure and use it to shade the subtotals.
See solution
New layout (Order · Line · Type):
1 Sales · Revenue
2 Cost of goods sold · Cost
3 Gross profit · Subtotal
4 Payroll · Expense
5 Rent · Expense
6 Delivery · Expense
7 Other expenses · Expense
8 EBITDA · Subtotal
9 Depreciation · Expense
10 Total operating expenses · Subtotal
11 Operating income · Subtotal
New branch in the measure (before "Total operating expenses"):
SelectedLine = "EBITDA",
[Gross Profit] - CALCULATE ( [Operating Expenses], Expenses[Account] <> "Depreciation" ),
Is Subtotal = IF ( SELECTEDVALUE ( 'P&L Lines'[Type] ) = "Subtotal", 1, 0 )
With February's expenses ($6,150 in total), the February 2025 P&L reads: sales $19,547.06; cost of goods sold −$13,815.39; gross profit $5,731.67 (29.3%); expenses −$6,150.00 (31.5% of sales); and operating income −$418.33, a 2.1% loss. Sales fell 11.1% from January and landed below February's break-even point of about $20,974. Across both months, cumulative operating income is just $145.60.
With depreciation included, January's EBITDA is $563.93 ($6,638.93 − $6,075) and operating income drops to $338.93 ($6,638.93 − $6,300). Notice you didn't touch the expense rule: "Depreciation" is one more Expense row, and EBITDA is a Subtotal line with its own condition.
Common P&L mistakes
Relating the layout table to Sales or Expenses.
Leave it disconnected: the measure decides what to calculate based on the line.
Misspelling an account ("Delivery " with a trailing space) so the line comes out blank.
Trim and standardize names in Power Query; the text must match exactly.
Leaving the matrix's own subtotals turned on.
Turn them off: your subtotals are lines in the layout.
Showing costs and expenses as positive numbers and subtracting "in your head".
Negative signs (or parentheses) so the statement reads correctly top to bottom.
Publishing without tying out to the books.
Compare a closed month and document every difference, like the P99 sales with no cost.
Summary
- A P&L combines sales, costs and expenses from different tables in a fixed order with subtotals.
- The technique: an unrelated layout table sorted by an Order column, plus a SWITCH ( TRUE (), … ) measure.
- Costs and expenses are negative; percent of sales uses total sales as the denominator.
- Turn off the matrix's subtotals and highlight your own with conditional formatting.
- Before publishing, tie out a closed month to your accounting reports.
- Break-even (expenses ÷ gross margin %) tells you how much to sell to avoid a loss: in January 2025, Summit's margin of safety was only 8.5%.
Next lesson: Import vs. DirectQuery, Gateways and Scheduled Refresh in Power BI. You'll connect Power BI to real databases: storage modes, SQL queries, the gateway and scheduled refresh.
Create your account in 30 seconds, mark your lessons and download your certificate at the end.