You are on page 1of 25

Mastering the

Excel CUBE
Functions
Bay Area BI User Group | Mountain View | 8 May, !"#
$resenter Intro%uction
$eter Myers $eter Myers $eter Myers $eter Myers
BI Expert & Bitwise 'olutions
BBus, '() 'er*er MC'E, MC+, '() 'er*er MV$ ,since !!-.
Experience% in %esigning, %e*eloping an% /aintaining
Microso0t %ata1ase an% application solutions, since "22-
Focuses on e%ucation an% /entoring
Base% in Mel1ourne, Australia
peter3/yers41itwisesolutions3co/3au
http566www3lin7e%in3co/6in6peter8s/yers
'ession 918ecti*es
+o intro%uce each the Excel CUBE 0unctions
+o %escri1e when to use, an% not to use, the CUBE
0unctions
+o pro*i%e reco//en%e% practices
+o suggest a%*ance% scenarios
+o %e/onstrate how to create co/pelling an%
interacti*e reports 1ase% on the CUBE 0unctions
'ession 9utline
Intro%ucing the CUBE Functions
:hen to Use the CUBE Functions
:hen ;ot to Use the CUBE Functions
<eco//en%e% $ractices
A%*ance% 'cenarios
=e/onstrations
Intro%ucing the CUBE Functions
Excel !"> inclu%es se*en CUBE 0unctions & a*aila1le since
Excel !!-
CUBE 0unctions allow creating Excel report layouts cell?1y?
cell 1ase% on an Analysis 'er*ices BI 'e/antic Mo%el ,BI'M.
9nly wor7s 0or %ata /o%els that can 1e @uerie% with
Multi%i/ensional Expressions ,M=A.
+a1ular %ata /o%els in =irect(uery /o%e cannot 1e @uerie% 1y using
M=A
<eports can allow user input 1y using slicers, ti/elines an%
cell *alues ,si/ulating para/eters.
CUBE 0unction argu/ents can 1e %e0ine% 1y using
expressions & 1oth 1y using Excel or M=A expressions
Intro%ucing the CUBE Functions
=ata /o%el /eta%ata, /e/1ers, sets, tuples an%
0or/ats are cache% to /ini/iBe i/pact on the %ata1ase
Using the CUBE 0unctions can wor7 well 0or so/e report
%esigns, an% not so well 0or others
CUBE 0unction report layouts can 1e create% 1y
con*erting a $i*ot+a1le to 0or/ulas & it is a one?way
con*ersion, an% can 1e help0ul 0or 1eginners learning to
write CUBE 0or/ulas
Continue%
=e/onstrations
Con*erting a $i*ot+a1le to For/ulas
Intro%ucing the CUBE Functions
Excel inclu%es se*en CUBE 0unctions5
CUBEMEMBE<
CUBE'E+
CUBE'E+C9U;+
CUBE<A;CE=MEMBE<
CUBEVA)UE
CUBEC$IMEMBE<
CUBEMEMBE<$<9$E<+D
Continue%
Intro%ucing the CUBE Functions
Most CUBE 0unctions re@uire Connection an% Caption
para/eters
Connection5 Connection5 Connection5 Connection5 +ext string o0 the na/e o0 the wor71oo7
connection to the %ata /o%el
Create wor71oo7 connections to Analysis 'er*ices %ata /o%els, or
use the $ower$i*ot %ata /o%el wor71oo7 connection
E+his:or71oo7=ataMo%elF
+ip5 ;a/e the wor71oo7 connections appropriately & an% concisely &
1y using the Frien%ly ;a/e property
Caption5 Caption5 Caption5 Caption5 +ext string that is %isplaye% in the cell instea% o0 the
%e0ault caption, i0 one is %e0ine%, 0ro/ the %ata /o%el
Use this argu/ent to present a user?0rien%ly la1el
Continue%
Intro%ucing the CUBE Functions
<eturns a /e/1er or tuple 0ro/ the %ata /o%el
/e/1erGexpression /e/1erGexpression /e/1erGexpression /e/1erGexpression5 5 5 5 +ext string o0 an M=A expression that e*aluates
to a uni@ue /e/1er in the %ata /o%el3 Alternati*ely, it can 1e a
tuple, speci0ie% as a cell range or an array constant3
caption5 caption5 caption5 caption5 :hen a tuple is returne%, the caption use% is the one 0or the
last /e/1er in the tuple
Exa/ples o0 /e/1erGexpression /e/1erGexpression /e/1erGexpression /e/1erGexpression inputs5
H=ateI3HCalen%arI3HCD!">I
AJ"
,A, B, C.
A5C
CUBEMEMBER(connection, member_expression, caption)
Intro%ucing the CUBE Functions
<eturns a set o0 /e/1ers 0ro/ the %ata /o%el
setGexpression setGexpression setGexpression setGexpression5 5 5 5 A set expression
sortGor%er sortGor%er sortGor%er sortGor%er5 5 5 5 Integer *alue speci0ying the ran7 to return
sortG1y sortG1y sortG1y sortG1y5 5 5 5 +ext string o0 the *alue 1y which to sort, typically a
/easure
;ote5
+he sort para/eters are i%eal 0or passing in user pre0erence
,para/eters.
Excel slicers ,representing /ulti?/e/1er selection. can 1e
passe% in to the setGexpression setGexpression setGexpression setGexpression argu/ent
CUBESET(connection, set_expression, caption, sort_order, sort_by)
Intro%ucing the CUBE Functions
<eturns the nu/1er o0 ite/s in a set
set5 set5 set5 set5 +ext string or an Excel expression that e*aluates to a set
%e0ine% 1y the CUBE'E+ 0unction
;ote5
+his is the only CUBE 0unction that %oes not re@uire a
connection
It %oes re@uire the result o0 a CUBE'E+ 0unction to 1e passe% in
Can 1e use% to %eter/ine the nu/1er o0 /e/1ers selecte% in
an Excel slicer
Can 1e use% to %eter/ine report layout ,to si/ulate %yna/ic
rows6colu/ns.
CUBESETCOUNT(set)
Intro%ucing the CUBE Functions
<eturns the nth, or ran7e%, /e/1er in a set
setGexpression setGexpression setGexpression setGexpression5 5 5 5 A set expression, a CUBE'E+ 0unction, or re0erence to a CUBE'E+
0unction
ran75 ran75 ran75 ran75 Integer *alue speci0ying the ran7 to return
;ote5
+he 0irst /e/1er is ran7 "
<e@uesting a ran7 1eyon% the set /e/1er count will pro%uce an error
Can wor7 aroun% this 1y using IFE<<9<,CUBE<A;CE=MEMBE<,K., !.
+o return the 1otto/ n *alues, use the sortGor%er sortGor%er sortGor%er sortGor%er an% sortG1y sortG1y sortG1y sortG1y argu/ents o0 the
CUBE'E+ 0unction to re*erse the or%er o0 the set
:or7s 1est when cu1e sets ha*e a 0ixe%, an% 7nown, nu/1er o0 /e/1ers, such
as the top sales per0or/er, the top "! stu%ents, or the " /onths o0 a year
Use the <9: or C9)UM; 0unction to 1uil% a Ete/plate 0unctionF to copy an%
paste into a range
CUBERANKEDMEMBER(connection, set_expression, rank, caption)
Intro%ucing the CUBE Functions
<eturns an aggregate% *alue 0ro/ the %ata /o%el
/e/1erGexpression /e/1erGexpression /e/1erGexpression /e/1erGexpression5 5 5 5 +ext string o0 an M=A expression that
e*aluates to a /e/1er or tuple within the %ata /o%el3
Alternati*ely, it can 1e a set %e0ine% with the CUBE'E+ 0unction3
;ote5
Each /e/1erGexpression will 0or/ a tuple
I0 at least one ele/ent within the tuple is in*ali%, CUBEVA)UE
returns a LVA)UEM error *alue
Excel slicers an% ti/elines can 1e use% as /e/1er expressions
CUBEVALUE(connection, member_expression1, member_expression2)
Intro%ucing the CUBE Functions
<eturns a C$I property 0ro/ the %ata /o%el
7piGna/e 7piGna/e 7piGna/e 7piGna/e5 5 5 5 +ext string o0 the na/e o0 the C$I in the %ata /o%el
7piGproperty 7piGproperty 7piGproperty 7piGproperty5 5 5 5 Integer *alue speci0ying the C$I co/ponent to 1e
returne%, an% can 1e one o0 the 0ollowing5
CUBEKPIMEMBER(connection, kpi_name, kpi_property, caption)
Integer Enumerated constant
1 KPIValue
2 KPIGoal
3 KPIStatus
4 KPITrend
5 KPIWeight
6 KPICurrentTimeMember
;ote5
'tatus an% +ren% *alues represent a nor/aliBe%
*alue, typically5
'tatus5 ?" ,o00 trac7., ! ,slightly o00 trac7. an% " ,on trac7.
+ren%5 ?" ,%eteriorating., ! ,no change. an% " ,i/pro*ing.
Auto?co/plete %oes not list the a*aila1le status or
tren% *alues & you /ust 7now the/ & consult the
%ata /o%el %ocu/entation
Use Excel con%itional 0or/atting to hi%e *alues an%
represent the/ as color scales or icon sets
Intro%ucing the CUBE Functions
<eturns the *alue o0 a /e/1er property 0ro/ a cu1e
/e/1erGexpression /e/1erGexpression /e/1erGexpression /e/1erGexpression5 5 5 5 +ext string o0 an M=A expression o0 a /e/1er
within the cu1e, or a re0erence to an Excel 0or/ula that returns a
/e/1er ,CUBEMEMBE< or CUBE<A;CE=MEMBE<.
property5 property5 property5 property5 +ext string o0 the na/e o0 the property returne%, or a
re0erence to a cell that contains the na/e o0 the property
;ote5
Use0ul 0or intro%ucing properties li7e phone nu/1er, e/ail a%%ress,
price, etc3
Auto?co/plete %oes not list the a*aila1le /e/1er properties & you
/ust 7now the/ & consult the %ata /o%el %ocu/entation
+a1ular BI'M, inclu%ing $ower $i*ot, cannot %e0ine /e/1er properties
CUBEMEMBERPROPERTY(connection, member_expression, property)
=e/onstrations
$ro%ucing a =ash1oar% with the CUBE Functions
:hen to Use the CUBE Functions
:hen %ash1oar%?style layouts are re@uire%, especially when
pu1lishe% to 'hare$oint an% ren%ere% 1y Excel 'er*ices
+o repro%uce reports that /ust loo7 an% 1eha*e si/ilarly to
legacy reports
+o o*erco/e li/itations o0 $i*ot+a1les an% $i*otCharts
Create asy//etric reports ,this year *s3 last year. & though this coul%
possi1ly 1e achie*e% with a custo/ set
GE+$IV9+=A+A is not an elegant or easy way to retrie*e *alues 0ro/ a
$i*ot+a1le
:hen custo/iBe% M=A is re@uire%
+o integrate %ata 0ro/ /ultiple %ata /o%els
+o pro%uce easier logic 1y using Excel 0or/ula, instea% o0
M=A or =AA in the %ata /o%el
:hen ;ot to Use the CUBE Functions
:hen a $i*ot+a1le or $i*otChart, or $ower View, coul%
%eli*er the sa/e result
+hese report types pro*i%e structure% exploration an% rich
interacti*ity
+hese report types are easier to create
:hen interacti*ity is re@uire%5 sorting, 0iltering, etc3
'o/e o0 these can 1e si/ulate% with CUBE 0or/ulas 1y using
expressions, 1ut this ta7es /ore %e*elop/ent ti/e an% e00ort
:hen sets with *aria1le /e/1er counts nee% to 1e
%isplaye% & the CUBE<A;CE=MEMBE< 0unction will return
an error i0 re@uesting a ran7 1eyon% the set siBe
Dou can wor7 aroun% this 1y testing with the IFE<<9< 0unction
<eco//en%ations
)earn the CUBE 0unctions 1y starting with a $i*ot+a1le an%
con*erting it to 0or/ulas
Cnow M=A to custo/iBe 1eyon% the 1asics & you can wor7
1eyon% the Auto?co/plete options
A%opt a /etho%ical %esign approach to help i/ple/ent change
an% to trou1leshoot errors
Create a EGlo1alsF wor7sheet to %e0ine CUBE 0or/ulas an% annotate the/
Ni%e rows, colu/ns or wor7sheets that contain CUBE 0or/ulas
A*oi% co/plex CUBE 0or/ulas & 1rea7 the/ %own to s/aller 0or/ulas an%
nest the/
'tri*e 0or para/eter?%ri*en %esigns to allow 0or *aria1ility an%
user interacti*ity
=e0ine Excel na/e% ranges to si/pli0y 1uil%ing /e/1er an% set expressions
Use E%yna/icF expressions 1ase% on Excel 0or/ula
Use slicers an% ti/elines to allow users to interacti*ely 0ilter the report
<eco//en%ations
Use te/plate 0unctions to copy an% paste into ranges
+his is especially use0ul 0or the CUBE<A;CE=MEMBE< an%
CUBEVA)UE 0unctions
=e0ine captions to allow the CUBE 0or/ulas to 1len% into the
report
I0 the %ata /o%el %e0inition changes, 1e sure to re0resh the
wor71oo7 connection to up%ate the cache
+his is usually i/portant when /o%i0ying the e/1e%%e% $ower$i*ot
%ata /o%el
Expressions cannot 1e greater than OO characters, which is
the li/it 0or an argu/ent to a 0unction in Excel
+o o*erco/e the text length li/it, use re0erences to cells that contain
the expression, which can ha*e a text length siBe o0 up to >,-P-
characters
Continue%
A%*ance% 'cenarios
$ro%uce %yna/ic layouts 1y using /acros
Nowe*er, these reports cannot 1e ren%ere% 1y Excel 'er*ices
$ro%uce reports that integrate /e/1ers an% *alues 0ro/ /ultiple %ata
/o%els
Co/1ine the enterprise %ata /o%el with your $ower$i*ot %ata /o%el
Exten% the corporate %ata stores with custo/ %ata an%6or calculations
+ip5 It pays o00 to %esign %ata /o%els with a consistent structure ,%i/ension,
hierarchy, /e/1er na/es, etc3. & 1ut this is not necessary, 8ust easier
Use the +a1le Analysis +ools Excel %ata /ining a%%?in 1ase% on an Excel
ta1le o0 CUBE 0or/ulas
Create an Excel ta1le 1ase% on CUBE 0or/ulas as a source 0or other
*isualiBations5
$ower Map
Visio 'er*ices
Apps 0or 900ice
=e/onstrations
A%*ance% 'cenarios with the CUBE Functions
<esources
Excel CUBE Functions wi7i ,co/ing soon.
http566www3excelcu1e0unctions3co/
Channel 25 +echE% ;ew Qealan% !">
Vi%eo5 EMastering the Excel CUBE Functions in Excel !">F
http566channel23/s%n3co/6E*ents6+echE%6;ewQealan%6!">6=BI>!#
+han7 Dou

You might also like