0
0
Power BIbi_tool~10 mins

Pivoting columns in Power BI - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

Sales data showing product, month, and sales amount in rows.

CellValue
A1Product
B1Month
C1Sales
A2Apples
B2Jan
C2100
A3Apples
B3Feb
C3120
A4Oranges
B4Jan
C480
A5Oranges
B5Feb
C590
Formula Trace
PivotedTable = SUMMARIZE( SalesData, SalesData[Product], "Jan Sales", CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Jan"), "Feb Sales", CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Feb") )
Step 1: SUMMARIZE(SalesData, SalesData[Product], "Jan Sales", CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Jan"), "Feb Sales", CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Feb"))
Step 2: Calculate Jan Sales for Apples: CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Jan") where Product = Apples
Step 3: Calculate Feb Sales for Apples: CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Feb") where Product = Apples
Step 4: Calculate Jan Sales for Oranges: CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Jan") where Product = Oranges
Step 5: Calculate Feb Sales for Oranges: CALCULATE(SUM(SalesData[Sales]), SalesData[Month] = "Feb") where Product = Oranges
Step 6: Final Pivoted Table
Cell Reference Map
    A       B       C
1 |Product| Month | Sales |
2 |Apples | Jan   | 100   |
3 |Apples | Feb   | 120   |
4 |Oranges| Jan   | 80    |
5 |Oranges| Feb   | 90    |

References: Product (A2:A5), Month (B2:B5), Sales (C2:C5)
The formula uses columns Product, Month, and Sales from the SalesData table.
Result
    A        B         C
1 |Product | Jan Sales | Feb Sales |
2 |Apples  | 100       | 120       |
3 |Oranges | 80        | 90        |
The pivoted table shows each product with separate columns for January and February sales.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the CALCULATE function do in this formula?
ASorts the sales data alphabetically
BFilters sales by month and sums them
CDuplicates the sales data
DDeletes sales data for other months
Key Result
SUMMARIZE groups rows by a column and uses CALCULATE with filters to pivot data into new columns.