14 Practical PowerPivot & DAX Formulas for Excel 2010
If you expand the Orders and the Order Details tables in the PowerPivot Field
List, you can see the two new columns you added using DAX: Year and Sales
Amount. Under the Products table, you can also see your new Category column.
It looks no different from the original imported columns. You are ready to build
your first PowerPivot pivot table (hosted in Excel) by adding columns.
12. Right-click Category under the Products table (not CategoryName under
Categories) and choose Add to Column Labels. You can also drag and drop to the
Column Labels drop-zone. Do the same for ProductName. Under the Customers
table, right-click Country and choose Add to Row Labels (yes, columns can
become rows!). Do the same for City. Under the Order Details table, right-click
Sales Amount and choose Add to Values. Next, under the Orders table, right-
click Year and choose Add to Slicers Horizontal. Repeat this for the Category
column in the Products table. There should be seven entries in the bottom half of
the PowerPivot Field List—by default, the lower section of the PowerPivot Field
List contains drop-zones for different areas of the pivot table. Category appears
twice, and Sales Amount (in the Values section) is named Sum of Sales Amount.
Your PowerPivot Field List should look something like Figure 1-15.
13. Now is probably a good point at which to save your work. You save from Excel as
you normally do, although you can also save from the PowerPivot window. Both
the Excel workbook and the PowerPivot model, including both metadata and
data, are saved as one single .xlsx file. You have just created a multidimensional
cube without having to know anything about star schemas or cubes or dimensions
or facts/measures or SSAS. If you copy the .xlsx file and rename with a zip
extension, you can unzip the file. It contains quite a lot! In the customData
subfolder of the xl folder, there’s a file called item1.data, which is fairly big. This
file is your PowerPivot data.
14. In the pivot table, right-click on Argentina under Row Labels and choose
Expand/Collapse, followed by Collapse Entire Field. Repeat this process for
Beverages under Column Labels. Your pivot table should resemble Figure 1-16.
That’s pretty good for a few minutes’ work, isn’t it? You might want to experiment
with expanding and collapsing the countries and the categories. Something you
may not have seen before are the two slicers at the top. Try clicking individual
years or product categories to implement filters and watch the data change (it’s
really fast). To select more than one filter in a particular slicer, click the first tile
and hold down the ctrl key as you click others—the data will not refresh until
you release the ctrl key. Or you can hold down the mouse button to select
contiguous slicer tiles. To show all of the data and clear any slicer filters, click the
small filter funnel (which has a red cross when a filter is in operation) at the top
right of a slicer.