Preliminary preparation for connecting to CUBE
Cube is a member of the function family, but its special feature is that its use depends on the created model. In order to let everyone focus on the Cube function, two files are specially prepared:
▪Simple Cube model built with PowerBI
▪Special Excel to connect any Cube model with one click
The two documents can be obtained by replying the keyword "CUBE" to the official account.
Simple model introduction:
The model contains a sales subject data, the core is an order table, the detailed data related to the salesperson, region, customer, and product related to the order are all in other tables, and they are associated with the order table according to key fields. This is the CUBE model for our practice.
Open the Powerbi file of this DEMO, then open the customized Excel file, click the "button" in sheet1, and Excel is successfully connected to the CUBE model.
Get the first CUBE function with a pivot table
The easiest way to learn the CUBE function is to observe and imitate, so we first create a pivot table, then convert the pivot table into a CUBE function, and then disassemble the CUBE function.
Step 1: Click the button to get the pivot table as shown in the figure
Step 2: Create a pivot table, as shown below
Step 3: Convert the pivot table to a formula
At this point the pivot table has become a formula. We can first observe the formula for the monthly sales of furniture,
=CUBEVALUE("PBID",$E7,F$5)
=CUBEVALUE("PBID",CUBEMEMBER("PBID","[产品].[类别].&[家具]"),CUBEMEMBER("PBID","[Measures].[AC SALES]"))
-
which model? Answer: "PBID".
-
Under which dimensions? Answer: "[Dim Product].[Product Category].&[Technology]".
-
What is computational logic? Answer: "[Measures].[Model.Sales]".