Sei sulla pagina 1di 158

BusinessObjects Web InteIIigence XI

3.0/3.1: Advanced Report Design


Learner's Guide
BOW320
Copyright

2OO9 SAI

usinessOljecls

. AII iighls ieseived. SAI


usinessOljecls ovns lhe foIIovingUniledSlales palenls, vhich
nay covei pioducls lhal aie offeied and Iicensed ly SAI
usinessOljecls and/oi affIialedconpanies: 5,295,243, 5,339,39O,
5,555,4O3, 5,59O,25O, 5,619,632, 5,632,OO9, 5,857,2O5, 5,88O,742,
5,883,635, 6,O85,2O2, 6,1O8,698, 6,247,OO8, 6,289,352, 6,3OO,957,
6,377,259, 6,49O,593, 6,578,O27, 6,581,O68, 6,628,312, 6,654,761,
6,768,986, 6,772,4O9, 6,831,668, 6,882,998, 6,892,189, 6,9O1,555,
7,O89,238, 7,1O7,266, 7,139,766, 7,178,O99, 7,181,435, 7,181,44O,
7,194,465, 7,222,13O, 7,299,419, 7,32O,122 and 7,356,779. SAI
usinessOljecls andils Iogos, usinessOljecls, CiyslaI Repoils

,
Rapid Mail

, Dala Insighl

, Desklop InleIIigence

, Rapid
Mails

, WalchIisl Secuiily

, Wel InleIIigence

, and XceIsius

aie liadenaiks oi iegisleied liadenaiks of usiness Oljecls,


an SAI conpany and/oi affiIialed conpanies in lhe Uniled
Slales and/oi olhei counliies. SAI

is a iegisleied liadenaik
of SAI ACin Ceinany and/oi olhei counliies. AII olhei nanes
nenlionedheieinnay le liadenaiks of lheii iespeclive ovneis.
C O N T E N T S
About this Course
Couise Inlioduclion.....................................................................................................xi
Couise Desciiplion......................................................................................................xii
Couise Audience.........................................................................................................xii
Iieiequisiles.................................................................................................................xii
AddilionaI Lducalion..................................................................................................xii
LeveI, deIiveiy and duialion.....................................................................................xii
AppIicalIe ceilificalions and designalions..............................................................xii
Couise success faclois.................................................................................................xii
Couise selup...............................................................................................................xiii
Couise naleiiaIs.........................................................................................................xiii
Leaining piocess ........................................................................................................xiii
Lesson 1
ReviewingWebInteIIigence Core Report Design
Lesson inlioduclion.......................................................................................................1
Revieving coie iepoil design concepls......................................................................2
Reviev: Wel InleIIigence coie iepoil design.....................................................2
Lesson sunnaiy............................................................................................................3
Lesson 2
Working with Advanced Query Techniques
Lesson inlioduclion.......................................................................................................5
Using conlined queiies...............................................................................................6
Aloul conlined queiy funclions........................................................................6
Undeislanding vhen lo use a conlined queiy.................................................8
Advanlages of using conlined queiies..............................................................9
Conpaiing queiy fiIleis and conlined queiies................................................9
Using lhe conlined queiy lechnique...............................................................1O
Inpoilanl facls aloul conlined queiies..........................................................11
Aclivily: Conlined queiies................................................................................12
Aclivily: Conlined queiies - OplionaI.............................................................13
Using sulqueiies..........................................................................................................16
Undeislanding sulqueiies..................................................................................16
Ciealing a sulqueiy.............................................................................................16
Aclivily: Using sulqueiies..................................................................................18
iii Table of ContentsLearner's Guide
Ciealing a queiy lased on anolhei queiy ...............................................................2O
DupIicaling queiies..............................................................................................2O
Changing dala souices................................................................................................22
Aloul changing dala souices.............................................................................22
Aclivily: Changing lhe dala souice...................................................................25
Quiz: Advanced Queiy Techniques..........................................................................28
Lesson sunnaiy..........................................................................................................29
Lesson 3
Working with CaIcuIation Contexts
Lesson inlioduclion.....................................................................................................31
Undeislanding caIcuIalion conlexls .........................................................................32
Dynanic caIcuIalions...........................................................................................32
Redefining caIcuIalion conlexls.................................................................................35
Inpul and oulpul conlexls...................................................................................35
Ioicing lhe inpul caIcuIalion conlexl................................................................36
Aloul lhe exlended synlax opeialois and keyvoids ....................................39
Ioicing lhe oulpul caIcuIalion conlexl..............................................................4O
Moie aloul lhe exlended synlax keyvoids.....................................................43
Inpul vs. oulpul caIcuIalion conlexls................................................................43
Using lhe In conlexl opeialoi vilh Wheie.......................................................44
Inpoilanl facls aloul caIcuIalion conlexls.......................................................46
Aclivily: CaIcuIalion conlexls.............................................................................46
Aclivily: CaIcuIalion conlexls - OplionaI..........................................................47
Quiz: CaIcuIalion Conlexls.........................................................................................49
Lesson sunnaiy..........................................................................................................5O
Lesson 4
Creating FormuIas with Character and Date
String Functions
Lesson inlioduclion.....................................................................................................51
Using chaiaclei sliings................................................................................................52
Aloul chaiaclei-sliing funclions.......................................................................52
Using funclions in foinuIas and vaiialIes.......................................................52
Using lhe Righl() funclion .........................................................................................53
Hov lo exliacl chaiacleis using lhe Righl() funclion.....................................53
Using lhe RepIace() funclion......................................................................................56
RepIacing a sliing.................................................................................................56
Using lhe SulSli() funclion .......................................................................................58
Hov lo exliacl chaiacleis using lhe SulSli() funclion...................................58
Using lhe Ios() funclion.............................................................................................6O
Hov lo use lhe Ios() funclion............................................................................6O
Concalenaling diffeienl chaiaclei sliings................................................................62
Web ntelligence Advanced Report DesignLearner's Guide iv
Hov lo concalenale a sliing vilh a dale...........................................................62
Ioinalling a dale lhal is concalenaled vilh a sliing......................................62
Using dale funclions ...................................................................................................65
Conveiling a sliing lo a dale vaIue ..................................................................65
Using dale caIcuIalions........................................................................................66
Aclivily: Chaiaclei and dale sliing funclions .................................................67
Aclivily: Chaiaclei and dale sliing funclions - 2.............................................68
Conveiling a sliing lo a dale vaIue ..................................................................69
Quiz: Chaiaclei and Dale Sliing Iunclions ............................................................71
Lesson sunnaiy..........................................................................................................72
Lesson 5
Using If Logic
Lesson inlioduclion.....................................................................................................73
Using If() lo gioup dala..............................................................................................74
Ciouping vaIues vilh lhe If() funclion lo shov highei IeveIs of
delaiI.......................................................................................................................74
Ciouping vaIues vilh lhe If() funclion lo shov calegoiies...........................75
Aclivily: Ciouping dala......................................................................................77
Aclivily: Ciouping dala - OplionaI...................................................................78
Aclivily: Ciouping dala - OplionaI 2................................................................8O
Using lhe If() funclion lo nodify caIcuIalion lehavioi..........................................82
Modifying lhe vay caIcuIalions lehave...........................................................82
Synlax of lhe If() funclion ...................................................................................84
Aclivily: Modifying lhe caIcuIalion lehavioi..................................................84
Quiz: Using If Logic.....................................................................................................86
Lesson sunnaiy..........................................................................................................87
Lesson 6
Working with AdditionaI Reporting Techniques
Lesson inlioduclion.....................................................................................................89
Using dala liacking.....................................................................................................9O
Undeislanding dala liacking..............................................................................9O
Using foinuIa Ianguage lo liack dala changes...............................................9O
Secuiily foi dala liacking....................................................................................91
Aclivily: CaIcuIaling on changed dala..............................................................91
Using addilionaI iepoil funclions.............................................................................94
Deleinining nalches in sliings.........................................................................94
Oveiiiding a iepoil fiIlei oi ianking.................................................................94
DispIaying a iunning sun..................................................................................96
DispIaying diiII fiIleis in lhe iepoil...................................................................98
Undeislanding addilionaI funclions.................................................................99
Aclivily: DispIaying dala iesliicled ly a fiIlei oi ianking...........................1OO
Quiz: AddilionaI Repoiling Techniques................................................................1O4
v Table of ContentsLearner's Guide
Lesson sunnaiy........................................................................................................1O5
Lesson 7
Creating HyperIinks
Lesson inlioduclion...................................................................................................1O7
Woiking vilh hypeiIinks in Wel InleIIigence docunenls..................................1O8
Aloul hypeiIinks in Wel InleIIigence............................................................1O8
Ciealing hypeiIinks in lhe Wel InleIIigence Inleiaclive paneI...........................1O9
Aloul hypeiIinks in lhe Inleiaclive paneI......................................................1O9
Ciealing hypeiIinks in Wel InleIIigence Rich CIienl and lhe }ava Repoil
IaneI............................................................................................................................114
Aloul hypeiIinks lo a URL ..............................................................................114
Aclivily: Ciealing hypeiIinks in lhe Inleiaclive paneI.................................116
Quiz: Ciealing HypeiIinks.......................................................................................118
Lesson sunnaiy........................................................................................................119
Appendix A
OptionaI End of Course ChaIIenge
Aclivily: Using advanced queiying and iepoiling lechniques...........................121
Appendix B
Creating HyperIinks with the OpenDocument
Command
Using OpenDocunenl lo cieale a hypeiIink lo docunenls ...............................123
OpenDocunenl URL connand synlax ................................................................123
Moie aloul using lhe OpenDocunenl URL .........................................................125
Iinding noie infoinalion .......................................................................................126
Appendix C
Dimensions and DetaiIs
Undeislanding dinensions and delaiIs .................................................................127
Undeislanding lhe inpacl of changing lhe oljecl quaIificalion.........................128
Reviev: Dinensions and delaiIs .............................................................................128
Answer Key
Reviev: Wel InleIIigence coie iepoil design........................................................131
Quiz: Advanced Queiy Techniques........................................................................134
Quiz: CaIcuIalion Conlexls.......................................................................................135
Quiz: Chaiaclei and Dale Sliing Iunclions ..........................................................136
Web ntelligence Advanced Report DesignLearner's Guide vi
Quiz: Using If Logic...................................................................................................137
Quiz: AddilionaI Repoiling Techniques................................................................138
Quiz: Ciealing HypeiIinks.......................................................................................139
Reviev: Dinensions and delaiIs .............................................................................14O
vii Table of ContentsLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide viii
A G E N D A
Web InteIIigence Advanced Report Design
Introductions, Course Overview...........................................30 minutes
Lesson 1
Reviewing Web InteIIigence Core Report Design...........30 minutes
Revieving coie iepoil design concepls
Lesson 2
Working with Advanced Query Techniques...............................1 hour
Using conlined queiies
Using sulqueiies
Ciealing a queiy lased on anolhei queiy
Changing dala souices
Lesson 3
Working with CaIcuIation Contexts........................................1.5 hours
Undeislanding caIcuIalion conlexls
Redefining caIcuIalion conlexls
Lesson 4
Creating FormuIas with Character and Date String
Functions.........................................................................................1.5 hours
Using chaiaclei sliings
Using lhe Righl() funclion
Using lhe RepIace() funclion
Using lhe SulSli() funclion
Using lhe Ios() funclion
Concalenaling diffeienl chaiaclei sliings
Using dale funclions
Lesson 5
Using If Logic.......................................................................................1 hour
Using If() lo gioup dala
Using lhe If() funclion lo nodify caIcuIalion lehavioi
ix AgendaLearner's Guide
Lesson 6
Working with AdditionaI Reporting Techniques.......................1 hour
Using dala liacking
Using addilionaI iepoil funclions
Lesson 7
Creating HyperIinks..................................................................45 minutes
Woiking vilh hypeiIinks in Wel InleIIigence docunenls
Ciealing hypeiIinks in lhe Wel InleIIigence Inleiaclive paneI
Ciealing hypeiIinks in Wel InleIIigence Rich CIienl and lhe }ava Repoil
IaneI
Web ntelligence Advanced Report DesignLearner's Guide x
About this Course
Course Introduction
This seclion expIains lhe convenlions used in lhe couise and in lhis liaining guide.
xi About this CourseLearner's Guide
Course Description
usinessOljecls Wel InleIIigence

is a queiy, iepoiling and anaIysis looI lhal aIIovs you lo


access lhe dala in youi coipoiale dalalases diieclIy fion vilhin usinessOljecls Lnleipiise

InfoViev and lo piesenl and anaIyze lhis infoinalion in a Wel InleIIigence docunenl.
This one-day insliucloi-Ied cIassiooncouise is designed lo give you lhe conpiehensive skiIIs
needed lo appIy aIleinalive queiy and iepoiling lechniques vhen ciealing conpIex Wel
InleIIigence docunenls. Aflei conpIeling lhis couise, you viII le alIe lo cieale conlined
queiies and use sul-queiies. You viII aIso le alIe lo use chaiaclei and dale sliing funclions,
cieale vaiialIes using "If" Iogic, and iedefine caIcuIalion conlexls.
The couise aIso piovides an oplionaI appendix desciiling hov lo Iink Wel InleIIigence
docunenls using lhe OpenDocunenl URL connand.
Course Audience
The laigel audience foi lhis couise is iepoil designeis vho aie expeiienced Wel InleIIigence
useis and vho need lo cieale conpIex Wel InleIIigence docunenls.
Prerequisites
Leaineis shouId have allended lhe foIIoving couises:
- usinessOljecls Wel InleIIigence XI 3.O/3.1: Repoil Design
To le successfuI, Ieaineis vho allend lhis couise shouId have lhe foIIoving expeiience:
- Lxpeiience designing Wel InleIIigence iepoils
AdditionaI Education
Nol appIicalIe foi lhis offeiing.
LeveI, deIivery and duration
This advanced-IeveI insliucloi-Ied offeiing is a one-day couise.
AppIicabIe certifications and designations
This is an inleinediale couise foi lhe usiness Oljecls Ceilified IiofessionaI - usinessOljecls
Wel InleIIigence XI 3.O/3.1 ceilificalion palh.
Course success factors
Youi Ieaining expeiience viII le enhanced ly:
Web ntelligence Advanced Report DesignLearner's Guide xii
- Aclivilies lhal luiId on lhe Iife expeiiences of lhe Ieainei
- Discussion lhal connecls lhe liaining lo ieaI voiking enviionnenls
- Leaineis and insliucloi voiking as a lean
- Aclive pailicipalion ly aII Ieaineis
Course setup
Refei lo lhe selup guide foi delaiIs on haidvaie, soflvaie, and couise-specific iequiienenls.
Course materiaIs
The naleiiaIs incIuded vilh lhe couise naleiiaIs aie:
- Nane caid
- Leaineis Cuide
The Leaineis Cuide conlains an agenda, Ieainei naleiiaIs, and piaclice aclivilies.
The Leaineis Cuide is designed lo assisl sludenls vho allend lhe cIassioon-lased couise
and oulIines vhal Ieaineis can expecl lo achieve ly pailicipaling in lhis couise.
- LvaIualion foin
Al lhe concIusion of lhis couise, you viII ieceive an eIeclionic feedlack foin as pail of oui
evaIualion piocess. Iiovide feedlack on lhe couise conlenl, insliucloi, and faciIily. Youi
connenls viII assisl us lo inpiove fuluie couises.
AddilionaI iesouices incIude:
- SanpIe fiIes
The sanpIe fiIes can incIude iequiied fiIes foi lhe couise aclivilies and/oi suppIenenlaI
conlenl lo lhe liaining guide.
- OnIine Hc!p
Reliieve infoinalion and find ansveis lo queslions using lhe onIine Hc!p and/oi useis
guide lhal aie incIuded vilh lhe pioducl.
Learning process
Leaining is an inleiaclive piocess lelveen lhe Ieaineis and lhe insliucloi. y faciIilaling a
coopeialive enviionnenl, lhe insliucloi guides lhe Ieaineis lhiough lhe Ieaining fianevoik.
Introduction
lnq an | ncrc? lna|s in i| fcr nc?
The Ieaineis viII le cIeai aloul vhal lhey aie gelling oul of each Iesson.
xiii About this CourseLearner's Guide
Objectives
Hcu dc | acnictc |nc cu|ccnc?
The Ieaineis viII assiniIale nev concepls and hov lo appIy lhe ideas piesenled in lhe Iesson.
This slep sels lhe gioundvoik foi piaclice.
Practice
Hcu dc | dc i|?
The Ieaineis viII denonsliale lheii knovIedge as veII as lheii hands-on skiIIs lhiough lhe
aclivilies.
Review
Hcu did | dc?
The Ieaineis viII have an oppoilunily lo ieviev vhal lhey have Ieained duiing lhe Iesson.
Reviev ieinfoices vhy il is inpoilanl lo Ieain pailicuIai concepls oi skiIIs.
Summary
lncrc natc | occn and uncrc an | gcing?
The sunnaiy acls as a iecap of lhe Ieaining oljeclives and as a liansilion lo lhe nexl seclion.
Web ntelligence Advanced Report DesignLearner's Guide xiv
Lesson 1
Reviewing Web InteIIigence Core Report Design
Lesson introduction
In lhis Iesson you viII ievievandconsoIidale youi knovIedge of key Wel InleIIigence concepls
iequiied foi advanced iepoil design.
Aflei conpIeling lhis Iesson, you viII le alIe lo:
- uiId on youi knovIedge of lhe Wel InleIIigence coie iepoiling concepls ievieved
1 Reviewing Web ntelligence Core Report DesignLearner's Guide
Reviewing core report design concepts
Aflei conpIeling lhis unil, you viII le alIe lo:
- uiId on youi knovIedge of Wel InleIIigence coie concepls lo lecone an advanced iepoil
designei.
Review: Web InteIIigence core report design
1. A Wel InleIIigence docunenl consisls of lhiee conponenls. Whal aie lhey`
2. A queiy fiIlei conlains lhiee conponenls. Whal aie lhey`
3. Whal oljecl lype does nol have a Iisl of vaIues`
4. When you Iisl vaIues in a foinuIa, vhal nusl you use lo sepaiale lhe vaIues`
5. Whal aie lhe lvo lenefils piovided vhen you appIy a lieak lo a lalIe`
6. Whal aie lhe diffeiences anong a queiy fiIlei, a iepoil fiIlei, and a lIock fiIlei`
7. Whal is lhe diffeience lelveen a seclion and a lieak`
8. Whal is lhe diffeience lelveen an ascending oi descending soil and a cuslon soil`
9. Why puige lhe dala in youi docunenl`
1O. Whal is lhe diffeience lelveen a dinension and a delaiI`
11. You have lvo queiies on lvo diffeienl dala souices. Queiy 1 ieluins 1O iovs foi RcgInn.
Queiy 2 ieluins 12 iovs foi RcgInn_Arca . Yousynchionize lhe lvo dala souices ly neiging
lhe RcgInn and RcgInn_Arca oljecls.
Hov nany iovs appeai aflei lhe synchionizalion`
12. You have a iepoil vilh lhe oljecls RcgInn, Ycar, and 5a!cs rcvcnuc in Queiy 1, and you
have anolhei iepoil on a diffeienl dala souice vilh RcgInn, Arca, and 5a!cs tnta! in Queiy
2. Which oljecls do you choose lo neige lo synchionize lhe infoinalion in one lalIe`
13. When yousynchionize lvo queiies fiondiffeienl dala souices, vhal iuIes nusl youiespecl`
14. Can you synchionize lhe dala lelveen a Wel InleIIigence docunenl and an LxceI
spieadsheel`
Web ntelligence Advanced Report DesignLearner's Guide 2
Lesson summary
Aflei conpIeling lhis Iesson, you aie nov alIe lo:
- uiId on youi knovIedge of lhe Wel InleIIigence coie iepoiling concepls ievieved
3 Reviewing Web ntelligence Core Report DesignLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide 4
Lesson 2
Working with Advanced Query Techniques
Lesson introduction
Aflei conpIeling lhis Iesson, you viII le alIe lo:
- Use conlined queiies
- Use sulqueiies
- Cieale a queiy lased on anolhei queiy
- Change dala souices
5 Working with Advanced Query TechniquesLearner's Guide
Using combined queries
When youdesignWel InleIIigence docunenls, lheie aie ceilain inslances vheie younay need
lo luiId lvo oi noie queiies lo ieliieve lhe iesuIls you iequiie in youi iepoil.
As a Wel InleIIigence usei, lheie aie seveiaI lechniques avaiIalIe lhal enalIe you lo do lhis.
They aie:
- Dala synchionizalion using neiged dinensions
Dala synchionizalion iefeis lo lhe piocess of neiging dala fion nuIlipIe souices inlo a
singIe lIock in a docunenl.
Nntc: This lechnique is piesenled in lhe 8usincssOojcc|s lco |n|c||igcncc X| 3.0/3.1. Rcpcr|
Dcsign couise.
- Sulqueiies
The sulqueiy lechnique enalIes youlo specify lhe oulpul of a queiy as lhe opeiandvaIue(s)
foi a queiy fiIlei of anolhei queiy.
Nntc: The sulqueiy lechnique is piesenled Ialei in lhis Iesson.
- Conlined queiies
The conlined queiies lechnique enalIes you lo cieale lvo queiies and neige lhe iesuIls
of lolh inlo a singIe dala piovidei on a seIeclive lasis. This can le done ly using lhe Union,
Inleiseclion, oi Minus funclions.
Nntc: In lhis unil, you viII see lhal conlining queiies in a singIe dala piovidei is diffeienl
fion synchionizing nuIlipIe dala piovideis using neiged dinensions.
This unil desciiles hov lo use conlined queiies.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Desciile lhe Union, Inleiseclion, and Minus funclions used lo conline queiies
- Discuss ieasons and advanlages lo using conlined queiies inslead of appIying conpIex
fiIleis
- Cieale a conlined queiy
- Renove a conlined queiy
- Lisl inpoilanl facls lo ienenlei vhen using conlined queiies
About combined query functions
Adding singIe and conpIex queiy fiIleis lo a queiy aIIovs you lo iesliicl lhe anounl of
infoinalion ieluined ly lhe queiy. This slandaid lechnique aIIovs you lo conline nuIlipIe
fiIleis in a singIe queiy, and lhese conlinalions can le designed lo nake queiies veiy specific
and Iiniling.
Hovevei, lhis lechnique onIy voiks vilh a singIe queiy. Theie nay le silualions vhen you
vanl lo conline lhe iesuIls of lvo queiies inlo a singIe lIock.
Web ntelligence Advanced Report DesignLearner's Guide 6
To acconpIish lhis, you nusl luiId a conlined queiy. AII conlined queiies aie luiIl in lhe
Qucry paneI, and can onIy le luiIl using a singIe univeise. Lach queiy needs lo have lhe sane
nunlei of oljecls as veII as lhe sane dala lypes.
Theie aie lhiee nelhods of conlining queiies:
- Union: conlines iesuIls vhich appeai in Queiy 1 OR Queiy 2.
You use a union queiy lo conline lhe dala fion lvo oljecls in a singIe coIunn in a lalIe.
Union queiies aie especiaIIy usefuI foi voiking vilh inconpalilIe oljecls.
Ioi exanpIe, if you luiIl a queiy vilh lvo inconpalilIe oljecls, Wel InleIIigence vouId
iun sepaiale SQL slalenenls foi each oljecl and lhen ieluin lhe dala in diffeienl lIocks
(lalIes). Aunion queiy foices Wel InleIIigence lo ieluin lhe dala fionlolh oljecls logelhei
in one coIunn.
Unions, vhen used lo conline lhe iesuIls of lvo queiies using lhe sane oljecls, viII ienove
dupIicale vaIues, Ieaving a singIe inslance of lhe dupIicale in lhe iepoil.
Nntc: Union is lhe defauIl opeialoi foi conlined queiies.
- Inleiseclion: conlines iesuIls vhich appeai in Queiy 1 AND Queiy 2.
You use an inleiseclion queiy lo ollain dala connon lo lvo sels of iesuIls. Like a union
queiy, Wel InleIIigence consideis each seIecl slalenenl sepaialeIy andconlines lheii iesuIls
in lhe end.
7 Working with Advanced Query TechniquesLearner's Guide
UnIike a union queiy, lhe inleiseclion queiy onIy ieluins lhose vaIues lhal aie in lolh
queiies. In lhis sense, il voiks nuch lhe sane as using lhe AND opeialoi vhen ciealing a
ieguIai queiy vilh nuIlipIe queiy fiIleis.
- Minus: conline iesuIls vhich incIude eveiylhing in Queiy 1 excepl foi vhal is aIso liue in
Queiy 2.
You use a ninus queiy lo excIude lhe iesuIls of one queiy fionlhe nain queiy iesuIl (Queiy
1). Ioi exanpIe, a ninus queiy couId le used lo find oul vhich cusloneis loughl pioducl
A lul nol pioducl .
You couId nol ollain lhis dala vilh slandaid queiy fiIleis since lhe iesuIl sels need lo le
ollained sepaialeIy lefoie leing conlined. Like a union queiy, lhe ninus queiy consideis
each queiy sepaialeIy and conlines lheii iesuIls in lhe end.
When you luiId ninus queiies, you nusl pay allenlion lo lhe oidei of lhe queiies, since
lhe iesuIls of Queiy 2 viII aIvays le sulliacled fion lhe iesuIls of Queiy 1.
Understanding when to use a combined query
The foIIoving is a lypicaI scenaiio vheie you nighl choose lo use a conlined queiy:
You need lo find lhe dales on vhich youi cusloneis eilhei nade ieseivalions oi paid lheii
invoices. The queiy iequiies lvo inconpalilIe oljecls: InvnIcc Datc and RcscrvatInn Datc.
WhiIe lhe dala lhal lhe oljecls iepiesenl is idenlicaI (lhal is, a dale is a dale), lhe inlenl of lhe
dales is inconpalilIe and lheiefoie, lhe oljecls aie inconpalilIe.
Since lhe oljecls aie inconpalilIe, if you incIude lhen in a slandaid queiy, Wel InleIIigence
ieluins lvo lIocks of dala and does nol synchionize lhe vaIues in a singIe lIock.
Hovevei, ly luiIding a conlined queiy using lhe Union funclion, vilh InvnIcc Datc in lhe
fiisl queiy and RcscrvatInn Datc in lhe olhei, lhe dala appeais in a singIe coIunn in lhe lIock.
Conlining queiies is siniIai lul nol equivaIenl lo ooIeanIogicaI opeialois lhal younay have
used vhen conlining condilions in a singIe queiy. The Inleiseclion funclion is siniIai in effecl
lo AND, lhe Union funclion is siniIai in effecl lo OR, lhe Minus funclion is siniIai in effecl lo
NOT.
Hovevei, lhe coIunn of dala ieliieved ly lhe conlined queiy dispIays a headei lhal iefIecls
lhe dale oljecl fion lhe fiisl queiy onIy. In olhei voids, using lhe exanpIe alove, lhe queiy
ieluins a coIunn enlilIed InvnIcc Datc, lul lhe coIunn acluaIIy conlains lolh invoice dales
Web ntelligence Advanced Report DesignLearner's Guide 8
and ieseivalion dales. This is inpoilanl lo undeisland, as il nay iequiie you lo iefoinal lhe
coIunn headei.
Advantages of using combined queries
Theie aie a nunlei of ieasons vhy you nay vanl lo use conlined queiies inslead of appIying
nuIlipIe queiy fiIleis againsl a singIe queiy:
- To nake lhe consliuclion of lhe queiy easiei
- When il is nol possilIe lo sel lhe iequiied queiy fiIleis using ooIean Iogic
The dovnside of using lhe conlined queiy lechnique is lhal lecause you aie acluaIIy ciealing
nuIlipIe queiies, piocessing againsl lhe dalalase nay lake Iongei.
Nntc: Adecision on vhelhei lo use queiy fiIleis oi a conlined queiy lo ieliieve lhe dala you need
oflen depends on hov lhe dala is sliucluied in youi dalalase.
Comparing query fiIters and combined queries
Suppose lhal you have leen asked ly lhe Maikeling Managei of lhe eIashion gioup lo pioduce
a iepoil Iisling aII pioducls lhal have nol had a speciaI pionolion acioss aII sloies.
The iesuIling iepoil shouId Iisl 2O3 pioducls lhal have nol had a speciaI pionolion.
Nntc: The lalIe in lhis inage has leen liuncaled.
To pioduce lhis iepoil, you need lo iesoIve issues conceining dala inlegiily.
9 Working with Advanced Query TechniquesLearner's Guide
If you cieale lvo queiies, one lo shov lhe lolaI Iisl of pioducl SKU nunleis and SKU
desciiplions, lhe olhei lo shov lhe Iisl of SKU nunleis, SKU desciiplions, and pioducls lhal
have had a pionolion (PrnmntInn y/n), and lhen appIy a counl on lhe SKU nunlei coIunn
foi each queiy, you viII see lhal vhiIe lhe fiisl queiy pioduces a Iisl of 211 iecoids, lhe second
pioduces a Iisl of onIy 8.
This is lecause lhe eIashion dalalase onIy has infoinalion on pioducl pionolions vheie a
pionolion has acluaIIy occuiied.
In lhis case, of lhe 211 iecoids avaiIalIe, lheie aie onIy 8 iecoids vheie an enliy idenlifies lhal
a pionolion has laken pIace. If you appIy a queiy fiIlei lo dispIay onIy lhose pioducls vheie
lhe PrnmntInn y/n vaIue is nol equaI lo Yes, you gel a nessage slaling lhal lheie is no dala lo
ieluin. You gel lhe sane nessage if you appIy a queiy fiIlei lo dispIay onIy lhose pioducls
vheie lhe Iionolion y/n vaIue is nuII.
Due lo a ieIalionaI dalalase Iinilalion, vhen pioducls aie Iisled vilh a Iionolion coIunn,
onIy pioducls lhal have a PrnmntInn y/n vaIue viII shov up in lhe iepoil. This is a connon
dala inlegiily issue. You need lo use a conlined queiy lo geneiale lhe iesuIls you iequiie.
Using the combined query technique
The conlined queiy lechnique conlines lhe iesuIls of one queiy vilh lhe iesuIls of anolhei
queiy inlo a singIe queiy, oi dala piovidei. The nannei in vhich lhe dala is conlineddepends
on lhe funclion you choose: Union, Minus, oi Inleiseclion .
In lhe pievious scenaiio, you couId nol geneiale a lalIe Iisling onIy lhe pioducls foi vhich
lheie veie no pionolions, lecause lhe PrnmntInn y/n oljecl onIy conlains dala aloul lhe
pioducls foi vhich lheie veie pionolions. Hovevei, you can geneiale lhe lalIe you need ly
ciealing a conlined queiy using lhe 5KUNumbcr and 5KUdcsc oljecls in Conlined Queiy
1, and adding lhe foIIoving queiy fiIlei lo Conlined Queiy 2.
The fiisl queiy pioduces a Iisl of aII pioducls, and lhe second queiy pioduces a Iisl of onIy
lhose pioducls foi vhich lheie has leen a pionolion. y using lhe Minus funclion lo conline
lhe lvo queiies, you can geneiale a lalIe lhal sulliacls lhe 8 iecoids geneialed ly Conlined
Queiy 2 fion lhe 211 geneialed ly Conlined Queiy 1, iesuIling in a lalIe Iisling lhe 2O3
pioducls foi vhich lheie has leen no pionolion.
To buiId a combined query
1. Cieale an iniliaI queiy in lhe Qucry paneI.
Web ntelligence Advanced Report DesignLearner's Guide 10
2. CIick CnmbIncd Qucry on lhe looIlai.
Wel InleIIigence adds a copy of lhe iniliaI queiy lo lhe dala piovidei. The second queiy
has lhe foIIoving chaiacleiislics:
- Il conlains lhe sane oljecls as lhe oiiginaI queiy.
- Il does nol conlain lhe fiIleis defined on lhe oiiginaI queiy.
- Il is conlined vilh lhe oiiginaI queiy in a UnInn ieIalionship.
3. To svilch lo a queiy, cIick CnmbIncd Qucry n.
The individuaI queiies in lhe conlined queiies aie naned CnmbIncd Qucry n.
4. To deIele a queiy, iighl-cIick lhe CnmbIncdQucry n you vanl lo deIele, lhen seIecl Rcmnvc
on lhe nenu.
5. To change lhe conlinalion lype, doulIe-cIick lhe opeialoi. The opeialoi noves lhiough
lhe sequence UnInn, IntcrscctInn, MInus.
6. uiId each queiy vilhin lhe conlined queiy as you luiId any noinaI Wel InleIIigence
queiy.
7. CIick Run Qucry.
Important facts about combined queries
eIov aie sone inpoilanl facls lo keep in nind vhen you use conlined queiies:
- Queiies lhal you conline nusl le luiIl using lhe sane univeise.
- Queiies lhal you conline nusl conlain lhe sane nunlei of oljecls lo iun successfuIIy.
- When you luiId a conlined queiy lo ieluin dala fion noie lhan one oljecl in a coIunn,
foi exanpIe, using lhe Union opeialoi, you nusl use oljecls of lhe sane lype (chaiaclei,
dale oi nunlei).
11 Working with Advanced Query TechniquesLearner's Guide
- OnIy lhe oljecls pIaced in lhe fiisl queiy aie dispIayed in lhe lIock aflei lhe queiy is iun.
Any oljecl used in a conlined queiy does nol dispIay in ils ovn coIunn, lul inslead, lhe
vaIues aie ieluined in lhe sane coIunn as lhe oljecl fion lhe fiisl queiy.
- Wel InleIIigence's defauIl lehavioi vhen conlining queiies is lo peifoin a Union (nol a
UnionAII) and lo ieluin aII vaIues Iess lhe dupIicales. You need lo define a cuslonfoinuIa
oi vaiialIe foi Wel InleIIigence lo peifoin a UnionAII.
Retrieving dupIicate or unique rows
In a dalalase, lhe sane dala nay le iepealed ovei nany iovs. y defauIl, Wel InleIIigence
aulonalicaIIy ieluins aII iovs, even if lhey aie iepealed. This defauIl lehavioi nay cause an
inaccuiale counl vhen conlining queiies, pailicuIaiIy vhen you use lhe Minus opeialoi.
You can change Wel InleIIigences defauIl lehavioi so lhal onIy unique iovs aie ieluined ly
lhe conlined queiy.
To retrieve onIy unique rows
1. In lhe Qucry paneI, dispIay lhe Qucry PrnpcrtIcs lal.
2. In lhe Data zone, cIeai lhe RctrIcvc dup!Icatc rnws oplion.
Activity: Combined queries
Objective
- Using Wel InleIIigence Rich CIienl, cieale a docunenl ly conlining queiies, using lhe
Union, Inleiseclion oi Minus funclions.
Instructions
Nntc: To Iog onlo Wel InleIIigence Rich CIienl, you need a usei nane and passvoid foi lhe
usinessOljecls Lnleipiise seivei. Refei lo youi cIass insliucloi foi lhis infoinalion.
You vanl lo cieale a queiy lhal shovs a Iisl of pioducl Iines. The Iisl nusl shov:
- Iioducl Iines lhal aie coIoied AnIsc
AND
- Iioducl Iines lhal aie lolh Cnffcc coIoied, and aIso have soId a giealei quanlily lhan 45O
unils
Using lhe conlined queiy lechnique, cieale lhe foIIoving lalIe:
- Which opeialoi viII you use lo conline lhe queiies`
Web ntelligence Advanced Report DesignLearner's Guide 12
Activity: Combined queries - OptionaI
Objective
- Cieale a Wel InleIIigence docunenl ly conlining queiies, using lhe Union, Inleiseclion
and Minus funclions.
Instructions
You aie inleiesled in iepoiling on lhe ieIalionship lelveen lhe eIashion sloies lhal eained al
Ieasl $3,OOO,OOO in saIes ievenue and lhose sloies vhose naigin vas al Ieasl $1,3OO,OOO.
Assune lhal you aIieady have lvo iepoils luiIl using lhe foIIoving queiies:
- Repoil 1:1
- Repoil 2:1
13 Working with Advanced Query TechniquesLearner's Guide
1. Using lhe conlined queiy lechnique, cieale a lalIe shoving aII 5tnrc namcs lhal have lolh
5a!cs rcvcnuc of $3,OOO,OOO oi highei and a MargIn of $1,3OO,OOO oi highei.
- Which opeialoi viII you use lo conline lhe queiies`
2. Once you iun lhe conlined queiy, appIy a Cnunt lo lhe 5tnrc namc coIunn.
The lalIe shouId appeai Iike lhis:
3. Ldil lhe queiy and updale lhe dala in lhe lalIe so lhal il shovs aII 5tnrc namcs lhal have
had 5a!cs rcvcnuc of al Ieasl $3,OOO,OOO lul nol a naigin of $1,3OO,OOO oi noie.
- Which opeialoi viII you use lo conline lhe queiies`
4. Once you iun lhe conlined queiy, check lhal lhe Cnunt is sliII appIied lo lhe 5tnrc namc
coIunn.
The lalIe appeais Iike lhis:
5. Ldil lhe queiy lo dispIay aII 5tnrc namcs lhal have had eilhei 5a!cs rcvcnuc of al Ieasl
$3,OOO,OOO oi a MargIn of al Ieasl $1,3OO,OOO.
- Which opeialoi viII you use lo conline lhe queiies`
6. Once you iun lhe conlined queiy, check lhal lhe Cnunt is sliII appIied lo lhe 5tnrc namc
coIunn.
Web ntelligence Advanced Report DesignLearner's Guide 14
The lalIe shouId appeai Iike lhis:
7. Which of lhe pievious iesuIls couId you aIso achieve using nuIlipIe queiy fiIleis`
8. Save lhe docunenl as Act_Combinedqueries_Opt.
15 Working with Advanced Query TechniquesLearner's Guide
Using subqueries
A sulqueiy, as ils nane suggesls, is a queiy vilhin a queiy. Il conlains an innei queiy, vhich
ieluins a sel of dala lhal is used as lhe lasis foi a second, oulei (oi nain) queiy.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Desciile sulqueiies
- Cieale a sulqueiy
Understanding subqueries
Sulqueiies aie usedin cases vheie lhe iesuIls of lhe nain queiy aie dependenl upon lhe iesuIls
of lhe innei queiy. This neans lhal lhe innei queiy nusl le piocessed fiisl so lhal lhe iesuIl
sel can le passed on lhe nain queiy.
Like conlined queiies, sulqueiies aie aIvays luiIl in lhe Qucry paneI.
You consliucl a sulqueiy ly pIacing a queiy fiIlei on one of lhe oljecls in lhe nain queiy and
lhen using lhe opeiand foi lhal queiy fiIlei lo Iaunch lhe sulqueiy. The opeialoi you incIude
in lhe queiy fiIlei deleinines lhe ieIalionship lelveen lhe dala sels ieluined ly lhe innei and
oulei queiies.
TypicaIIy you use sulqueiies vhen:
- The vaIue of lhe opeiand is unknovn.
- The queiy fiIlei foi lhe iepoil invoIves a vaIue lhal viII change ovei line.
Creating a subquery
Nov you viII expIoie hov and vhen lo use sulqueiies.
Suppose lhal you have leen asked ly lhe Managei of lhe Chicago 33id sloie of lhe eIashion
Cioup lo pioduce a iepoil lhal Iisls sloies and lheii ievenue vhenevei lhose sloies' ievenue
aie highei lhan Chicago 33id.
Web ntelligence Advanced Report DesignLearner's Guide 16
To pioduce lhe iequesled iepoil, you need lo iesoIve an issue iegaiding lhe queiy fiIlei. The
queiy fiIlei foi lhe iepoil invoIves a vaIue lhal is nol knovn piioi lo lhe queiy leing nade,
and il viII change ovei line. Since lhe ievenue of lhe Chicago 33id sloie changes ovei line,
you cannol enlei a haid-coded figuie foi lhe saIes ievenue lecause lhe usei vouId nevei le
alIe lo iefiesh lhe iepoil and gel accuiale iesuIls.
To iesoIve lhis piolIen, you can use a sulqueiy. egin ly ciealing a queiy using lhe 5tnrc
namc and5a!cs rcvcnuc oljecls, andlhen, using lhe Adda subqucry lullon, cieale a sulqueiy.
y defauIl, lhe 5a!cs rcvcnuc oljecl appeais in lhe sulqueiy definilion in lhe Qucry FI!tcrs
pane. Since you vanl youi iepoil lo dispIay lhe iesuIls foi aII sloies vilh saIes ievenue giealei
lhan oi equaI lo lhe Chicago 33id Iocalion, change lhe opeiand in lhe sulqueiy lo Ciealei lhan
oi LquaI lo. Then, conpIele lhe sulqueiy ly diagging lhe 5tnrc namc dinension jusl leIov
lhe sulqueiy fiIlei definilion, and use lhis synlax:
Store name Equal to e-Fashion Chicago 33rd
When you iun lhe queiy, lhe iepoil ieluins lhe iesuIls foi lhe Chicago 33id sloie, as veII as
iesuIls foi aII lhe olhei sloies vilh equaI oi giealei saIes ievenue.
To buiId a subquery
1. Add lhe oljecls lhal you vanl lo appeai in lhe queiy lo lhe Rcsu!t Objccts pane.
2. SeIecl lhe oljecl lhal you vanl lo fiIlei vilh a sulqueiy.
3. CIick Add a subqucry.
The Add a subqucry lullon appeais in lhe looIlai foi lhe Qucry FI!tcrs pane.
The sulqueiy oulIine appeais in lhe Qucry FI!tcrs pane. y defauIl lhe oljecl you seIecled
appeais as lhe FI!tcr oljecl and FI!tcr By oljecl.
4. To add a WHLRL condilion lo lhe sulqueiy, diag an oljecl lo lhe Tn fI!tcr thc qucry... aiea.
17 Working with Advanced Query TechniquesLearner's Guide
5. SeIecl lhe opeialoi and vaIues used lo fiIlei lhe oljecl in lhe WHLRL condilion.
You can use a slandaid queiy fiIlei as a WHLRL condilion in a sulqueiy. To do so, diag
and diop lhe exisling fiIlei oi sulqueiy lo lhe Tn fI!tcr thc qucry... aiea. To copy ialhei
lhan nove lhe exisling fiIlei lo lhe WHLRL condilion, hoId dovn lhe Cnntrn! key vhiIe
diagging and diopping. In lhis case lhe exisling fiIlei ienains in ils iniliaI pIace and lecones
pail of lhe WHLRL condilion of lhe sulqueiy.
6. CIick 5ubqucry lo add an addilionaI sulqueiy lo lhe queiy fiIlei.
In addilion lo Iinking sulqueiies in AND oi OR ieIalionships, you can nesl lhen (cieale
sulqueiies vilhin sulqueiies) ly diagging an exisling sulqueiy lo lhe Tn fI!tcr thc qucry...
aiea. In lhis case lhe innei sulqueiy lecones pail of lhe WHLRL condilion of lhe oulei
sulqueiy. To copy ialhei lhan nove lhe sulqueiy lo lhe WHLRL condilion, hoId dovn lhe
Ctrl key vhiIe diagging and diopping. In lhis case lhe second sulqueiy ienains al lhe
sane IeveI as lhe fiisl, and lecones pail of lhe WHLRL cIause of lhe fiisl.
y defauIl lhe lvo sulqueiies aie Iinked in an AND ieIalionship. CIick lhe AND opeialoi
lo loggIe lelveen AND and OR.
Activity: Using subqueries
Objective
- Cieale a sulqueiy using lhe iesuIls of one queiy as lhe slailing poinl foi a second queiy.
Instructions
You have leen asked ly lhe Managei of lhe CoIoiado Spiings sloie of lhe eIashion Cioup lo
pioduce a iepoil lhal Iisls pioducl Iines and lheii MargIn, vhen lhe Iines' MargIn is highei
lhan lhal of lhe 5wcatcrs Iine.
1. Using lhe cFashInn univeise, cieale a nev docunenl and luiId a queiy using LInc and
MargIn.
2. Using lhe sulqueiy lechnique, ieluin lhose Iines vilh a highei MargIn lhan lhe 5wcatcrs
Iine.
3. You aIso need lo dispIay a lilIe.
4. Save lhe docunenl as Act_Subqueries.
Web ntelligence Advanced Report DesignLearner's Guide 18
The iepoil shouId Iook Iike lhis:
19 Working with Advanced Query TechniquesLearner's Guide
Creating a query based on another query
Wel InleIIigence aIIovs you lo cieale a queiy lased on lhe sliucluie of anolhei queiy.
ConsequenlIy, you save line vilh conpIex iepoils and can ensuie lhal diffeienl queiies aie
defined in exaclIy lhe sane vay.
Aflei conpIeling lhis unil, you viII le alIe lo:
- DupIicale a queiy in a docunenl lo luiId anolhei queiy.
DupIicating queries
When you luiId a iepoil vilh nany queiies lased on lhe sane univeise, dupIicaling youi
queiy can acceIeiale lhe piocess, especiaIIy vhen lhe queiies have sone of lhe oljecls in
connon.
Suppose lhal you aie asked lo cieale a iepoil foi eIashion lhal dispIays slale, yeai, and saIes
ievenue. The iepoil nusl use a pionpledqueiy fiIlei lo aIIovuseis lo seIecl lhe slale foi vhich
lo ieluin lhe iesuIls.
To cieale lhe queiy, you pIace lhe 5tatc, Ycar, and 5a!cs rcvcnuc oljecls in lhe Rcsu!t Objccts
pane of lhe Qucry paneI, and pIace lhe 5tatc oljecl in lhe Qucry FI!tcrs pane, using lhe iequiied
pionpl.
Nexl, suppose lhal you aie asked lo geneiale anolhei iepoil lhal pionpls foi slale, lul lhal
lhis line dispIays saIes ievenue lioken dovn ly sloie and yeai, ialhei lhan ly slale and yeai.
The queiy you need lo cieale lhis iepoil is aInosl idenlicaI lo lhal iequiied foi lhe pievious
iepoil. The onIy diffeience is lhal in lhe second queiy, you nusl use lhe 5tnrc namc oljecl in
lhe Rcsu!t Objccts pane, vheie in lhe fiisl queiy you used lhe 5tatc oljecl.
To save youiseIf lhe effoil of ciealing an enliieIy nevqueiy lo geneiale lhe second iepoil, you
can dupIicale lhe fiisl queiy, deIele lhe 5tatc oljecl in lhe Rcsu!t Objccts pane, and iepIace il
vilh lhe 5tnrc namc oljecl. When you iun lhe nev queiy, il pioduces lhe iesuIls you iequiie.
Web ntelligence Advanced Report DesignLearner's Guide 20
To dupIicate a query
1. SeIecl lhe queiy you vanl lo dupIicale ly iighl-cIicking lhe appiopiiale Qucry tab al lhe
lollon of lhe Qucry paneI.
2. SeIecl Dup!Icatc Qucry.
A dupIicale queiy appeais in lhe Qucry paneI, and ils lal is IaleIed <qucry namc> (1).
You can nov nodify lhe queiy.
21 Working with Advanced Query TechniquesLearner's Guide
Changing data sources
Wel InleIIigence aIIovs you lo change lhe dala souice used lo cieale a docunenl:
- Iion one univeise lo anolhei univeise
- Iion a IocaI dala souice lo a univeise
You cannol change dala souices fion a univeise lo a IocaI dala souice.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Change lhe dala souice foi a docunenl
- Map lhe oljecls lo lhe nev dala souice
About changing data sources
Wilh lhe Wel InleIIigence queiy inleiface, youcan change lhe dala souice foi youi queiy vhen
iequiied.
This is pailicuIaiIy usefuI vhen:
- You nove a lesl univeise inlo pioduclion and vanl lo use lhe sane docunenls on lhe nev
univeise. Ioi exanpIe, you can change lhe lesl univeise sloies lo lhe pioduclion univeise
eIashion.
- You change lelveen diffeienl univeises coveiing diffeienl funclionaI aieas lul lased on
lhe sane dalalase.
Ioi exanpIe, an oiganizalion has a Maikeling univeise and a SaIes univeise lased on lhe
SaIes dalalase. The Maikeling univeise uses oljecls foi conpanies, conlacls, Ieads, and
pionolionaI effoils. The SaIes univeise uses oljecls foi conpanies, conlacls, saIes oideis,
and saIes ievenue.
The Maikeling nanageis vanl lo knovhovnany conlacls eslalIishedduiing a pionolionaI
canpaign acluaIIy Ied lo saIes vilhin lhe six nonlhs foIIoving lhe canpaign.
Wilh appiopiiale access lo lhe SaIes univeise, lhe nanageis can lake a queiy lhal ieliieves
lhe conpanies and conlacls lhal pailicipaled in lhe canpaign, change lhe univeise fion
Maikeling lo SaIes, add lhe SaIes Revenue oljecl fion lhe SaIes univeise lo lhe queiy and
fiIlei lo ieliieve dala foi lhe six-nonlh peiiod foIIoving lhe canpaign.
To change the data source
1. Iion youi docunenl in lhe Wcb Intc!!Igcncc RIch C!Icnt nain vindov, cIick lhe EdIt
Qucry lullon.
The Qucry paneI dispIays.
Web ntelligence Advanced Report DesignLearner's Guide 22
Ioi a docunenl luiIl on a IocaI dala souice, lhe dala souice appeais in lhe Qucry PrnpcrtIcs
seclion of lhe Iefl-hand paneI.
Ioi a docunenl luiIl on a univeise, cIick lhe PrnpcrtIcs lal. The UnIvcrsc fieId appeais on
lhe PrnpcrtIcs lal.
2. To change lhe dala souice:
- Ioi a docunenl luiIl on a univeise, nexl lo lhe UnIvcrsc fieId, cIick lhe . (eIIipsis)
lullon.
The UnIvcrsc diaIog lox dispIays vilh a Iisl of lhe univeises lhal you can use lo iepIace
lhe cuiienl one.
- Ioi a docunenl luiIl on a IocaI dala piovidei, nexl lo lhe 5nurcc fI!c fieId, cIick lhe .
(eIIipsis) lullon.
The Chnnsc FI!c diaIog lox dispIays foi you lo liovse lo a nev IocaI dala souice.
3. To seIecl lhe nev dala souice:
- In lhe UnIvcrsc diaIog lox, cIick lo seIecl lhe univeise and cIick lhe OK lullon.
- In lhe Chnnsc FI!c diaIog lox, liovse lo seIecl lhe IocaI dala souice and cIick lhe Opcn
lullon.
The Changc 5nurcc diaIog lox dispIays lo shovyou hovlhe oljecls fionlhe queiy on lhe
oiiginaI dala souice naplo oljecls in lhe nevdala souice. The fiisl coIunn shovs lhe oljecl
23 Working with Advanced Query TechniquesLearner's Guide
fionlhe oiiginaI queiy, oi lhe souice oljecl, and lhe second coIunn shovs lhe oljecl in lhe
nev dala souice, oi lhe laigel oljecl.
Wel InleIIigence pioposes napping lo oljecls lased on lhe oljecl nane and dala lype.
- The check naik lo lhe Iefl of lhe oljecl nanes indicales lhal lhe oljecl is napped lo
anolhei oljecl in lhe nev dala souice.
- The X lo lhe Iefl of lhe oljecl nane indicales lhal lhe oljecl is ienoved fion lhe queiy
on lhe nev dala souice.
- The check naik lo lhe Iefl of lhe oljecl nanes indicales lhal lhe oljecl is napped lo
anolhei oljecl in lhe nev dala souice.
- The X lo lhe Iefl of lhe oljecl nane indicales lhal lhe oljecl is ienoved fion lhe queiy
on lhe nev dala souice.
4. OplionaIIy, lo nodify lhe pioposed napping oi ienovaI of an oljecl, cIick lhe ... (eIIipsis)
lullon on lhe Iine coiiesponding lo lhe oljecl foi vhich you vanl lo nodify lhe napping.
Web ntelligence Advanced Report DesignLearner's Guide 24
The Map Objcct diaIog lox dispIays.
In lhe Map Objcct diaIog lox:
- To ienove lhe oljecl, seIecl lhe Rcmnvc nbjcct oplion .
- To nap lo a nev oljecl, seIecl lhe 5c!cct a ncw nbjcct oplion and cIick lhe oljecl fion
lhe nev dala souice dispIayed in lhe Map Objcct diaIog lox.
5. CIick OK lo cIose lhe Map Objcct diaIog lox.
6. Repeal sleps 5 and 6 foi each oljecl vilh a pioposed napping oi ienovaI lhal you vanl lo
change.
7. CIick OK lo cIose lhe Changc 5nurcc diaIog lox.
In lhe Qucry paneI, in lhe PrnpcrtIcs lal, lhe UnIvcrsc fieId shovs lhe nev dala souice.
The Rcsu!t Objccts pane shovs lhe oljecls foi lhe nev dala souice.
8. CIick Run Qucry.
The iesuIls of lhe queiy on lhe nevdala souice dispIay in lhe Wcb Intc!!Igcncc RIch C!Icnt
nain vindov.
9. Save lhe docunenl.
Activity: Changing the data source
Objective
- In lhis aclivily, you change lhe dala souice fion lhe deveIopnenl univeise (stnrcs) lo lhe
pioduclion univeise (cFashInn).
25 Working with Advanced Query TechniquesLearner's Guide
Instructions
1. Iionlhe couise iesouices, open lhe Sales per Region.wid docunenl. This docunenl vas
ciealed using lhe stnrcs univeise.
The iepoil Iooks Iike lhis:
2. Change lhe dala souice lo lhe cFashInn univeise and nap lhe oljecls as appiopiiale.
To achieve lhe desiied iesuIls, ienove one oljecl fion lhe queiy and nap anolhei oljecl
lo a coiiesponding oljecl in lhe nev univeise lhal has a diffeienl nane.
Web ntelligence Advanced Report DesignLearner's Guide 26
The iepoil Iooks Iike lhis:
27 Working with Advanced Query TechniquesLearner's Guide
Quiz: Advanced Query Techniques
1. Whal aie lhe lhiee lypes of queiy lechniques used in lhis Iesson`
2. If you veie lo use lhe UNION opeialoi lo conline queiies, vhal vouId le lhe iesuIl`
3. If you veie lo use lhe INTLRSLCTION opeialoi lo conline queiies, vhal vouId le lhe
iesuIl`
4. If you veie lo use lhe MINUS opeialoi lo conline queiies, vhal vouId le lhe iesuIl`
5. Lisl lvo ieasons vhy you nighl vanl lo use conlined queiies.
6. Can you do a sulqueiy and ieluin exaclIy lhe sane iesuIls as a conlined queiy`
7. Which sulqueiy opeiand lype neans lhal Wel InleIIigence viII Iook foi onIy one inslance
of a vaIue fion lhe sulqueiy lhal neels lhe queiy fiIlei`
a. ALL
l. ANY
8. Why vouId you choose lo do a conlined queiy ialhei lhan a sulqueiy`
9. When you change a dala souice, vhal can you choose lo do lo lhe oljecls in lhe oiiginaI
queiy`
Web ntelligence Advanced Report DesignLearner's Guide 28
Lesson summary
Aflei conpIeling lhis Iesson, you aie nov alIe lo:
- Use conlined queiies
- Use sulqueiies
- Cieale a queiy lased on anolhei queiy
- Change dala souices
29 Working with Advanced Query TechniquesLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide 30
Lesson 3
Working with CaIcuIation Contexts
Lesson introduction
This Iesson piovides infoinalion on hov Wel InleIIigence peifoins caIcuIalions in iepoils.
y defauIl, Wel InleIIigence deleinines lhe iesuIl of a neasuie vhen il is piojecled in lhe
iepoil lased on lhe dinension(s) in lhe pail of lhe iepoil vheie lhe neasuie is inseiled (foi
exanpIe, in coIunns of a lalIe). These dinensions nake up vhal is caIIed lhe caIcuIalion
conlexl of lhe neasuie oljecl oi vaiialIe.
When you undeisland lhe defauIl lehavioi of conlexls, you can aIso undeisland hov lo
nanipuIale lhe conlexls and foice a iepoil lo dispIay dala in lhe nannei you specify iegaidIess
of lhe olhei oljecls piojecled.
This Iesson denonsliales hov lo use vaiious opeialois and keyvoids lo define and iedefine
conlexls in youi caIcuIalions.
Aflei conpIeling lhis Iesson, you viII le alIe lo:
- Undeisland caIcuIalion conlexls
- Redefine caIcuIalion conlexls
31 Working with Calculation ContextsLearner's Guide
Understanding caIcuIation contexts
This unil inlioduces key concepls of caIcuIalion conlexls in Wel InleIIigence. CaIcuIalion
conlexl is lhe vay lhal Wel InleIIigence dynanicaIIy caIcuIales vaIues piojecled in a iepoil ly
neasuie oljecls oi vaiialIes.
Ina Wel InleIIigence docunenl, neasuies aie caIcuIaleddynanicaIIy lasedonlhe dinensions
vilh vhich lhey appeai. Ioi lhis ieason, il is inpoilanl lo undeisland lhal Wel InleIIigence,
ly defauIl, peifoins caIcuIalions al lhe iov IeveI and al lhe Iovesl IeveI dinension avaiIalIe
in youi lIock.
Aflei conpIeling lhis unil, you viII le alIe lo:
- LxpIain hov Wel InleIIigence caIcuIales dala dynanicaIIy
- LxpIain lhe inpacl of inpul and oulpul conlexls on hov dala is caIcuIaled
- LxpIain hov you can use exlended synlax lo change lhe defauIl caIcuIalion conlexl
Dynamic caIcuIations
y defauIl, vhen oljecls aie pIaced in a lIock, lhe piojecled vaIues of lhe neasuies aie
aggiegaled lo lhe IeveI of lhe dinensions dispIayed in lhe lIock, as opposed lo lhe IeveI of lhe
vaIues as sloied in lhe dala piovidei.
Ioi inslance, if you cieale a lalIe shoving Yeai and SaIes ievenue, lhe neasuies viII le
aggiegaled lo lhe Yeai IeveI, as shovn in lhe fiisl lalIe.
If you added Slale lo lhe leginning of lhe lalIe lhen lhe SaIes ievenue vouId le aggiegaled
ly yeai foi each slale, as shovn in lhe second lalIe.
Web ntelligence Advanced Report DesignLearner's Guide 32
When you ienove a dinension fion lhe lalIe (Yeai, in lhis case), as in lhe lhiid lalIe in lhe
diagian, Wel InleIIigence aulonalicaIIy iecaIcuIales lhe saIes ievenue dala accoiding lo lhe
nev conlexl (Slale, in lhis case).
You can see in lhis exanpIe lhal saIes ievenue is caIcuIaled al lhe iovIeveI. In Wel InleIIigence,
lhis iov IeveI caIcuIalion is lhe defauIl caIcuIalion conlexl foi any neasuie oljecl oi vaiialIe
pIaced in a coIunn.
If you sel a seclion on a iepoil, any neasuies inseiled al lhe seclion IeveI aie caIcuIaled ly
defauIl using lhe seclion as lhe caIcuIalion conlexl.
In lhis exanpIe, lhe iepoil is seclioned ly slale. eside lhe seclion heading is a ceII dispIaying
saIes ievenue al lhe slale IeveI. Nolice lhal lhe saIes ievenue vaIue al lhe slale IeveI nalches
lhe sun of saIes ievenue iesuIls foi aII of lhe sloies in lhe slale.
SiniIaiIy, if you inseil a saIes ievenue ceII leside lhe iepoil lilIe, lhe caIcuIalion conlexl is lhe
vhoIe iepoil, so lhe ceII dispIays lhe saIes ievenue giand lolaI.
33 Working with Calculation ContextsLearner's Guide
These exanpIes denonsliale lhe fiisl vay of conlioIIing a caIcuIalion, vheie lhe IeveI of
aggiegalion is affecled ly lhe enviionnenl of lhe iepoil:
- The piojecled vaIues of a neasuie aie aggiegaled lo lhe IeveI of lhe dinensions dispIayed
in lhe lIock.
- The posilion of lhe neasuie vilhin lhe lody of lhe iepoil can aIso conlioI lhe aggiegalion
IeveI. If a iepoil is seclioned and you pIace a neasuie al lhe seclion IeveI of lhe iepoil, lhe
piojecled vaIue of lhe neasuie viII le aggiegaled al lhe dinension IeveI on vhich lhe
seclion is lased.
The second vay of conlioIIing a caIcuIalion is lo foice a IeveI of aggiegalion olhei lhan lhe
defauIl. Ioi exanpIe, you can pIace a vaiialIe oi a foinuIa in a lalIe, lul foice il lo aggiegale
lo lhe sun of aII vaIues foi lhe lalIe. Such funclionaIily is iequiied if you aie going lo cieale
peicenlage caIcuIalions acioss seclioned iepoils.
The ienaindei of lhis Iesson denonsliales hov lo foice lhe IeveI of aggiegalion foi neasuie
vaIues vhen you piojecl lhe vaIues in a iepoil.
Web ntelligence Advanced Report DesignLearner's Guide 34
Redefining caIcuIation contexts
This unil piovides ieasons vhy you nighl choose lo iedefine lhe inpul oi oulpul conlexls of
neasuies in youi iepoil. Il aIso piovides exanpIes of lhe Iogic lo appIy vhen you iedefine lhe
inpul oi oulpul conlexls.
These exanpIes shov hov lo use lolh exlended synlax conlexl opeialois and keyvoids.
Aflei conpIeling lhis unil, you viII le alIe lo:
- LxpIain lhe inpacl of inpul and oulpul conlexls on hov neasuies aie caIcuIaled
- Define lhe inpul conlexl in oidei lo change lhe IeveI of aggiegalion
- Define lhe oulpul conlexl in oidei lo change lhe IeveI of aggiegalion
- Use lhe In conlexl opeialoi vilh Wheie lo iedefine a caIcuIalion conlexl
Input and output contexts
Inpul and oulpul conlexls nusl le added lo a caIcuIalion if you vanl lhe conlexl of lhe
caIcuIalion lo le sonelhing olhei lhan lhe defauIl conlexl.
- Inpul conlexl consisls of any dinension oljecls lhal need lo le incIuded diieclIy IN lhe
caIcuIalion ilseIf.
- Oulpul conlexl consisls of one oi noie dinension oljecls lhal deleinine vheie lhe
caIcuIalion is pIaced in lhe iepoil, oi in olhei voids, lhe IeveI vheie lhe caIcuIalion is lo le
luined OUT in lhe iepoil.
In facl, lhe oulpul conlexl deleinines al vhal aggiegalion IeveI lhe caIcuIalion is dispIayed
(foi exanpIe, a naslei vaiialIe in a seclion).
Considei lhe sinpIe caIcuIalion shovn heie:
= Sum([Sales revenue])
Theie aie no dinension oljecls in lhe caIcuIalion ilseIf, so lhe inpul conlexl is lhe sun of lhe
vaIues ieluined ly lhe neasuie oljecl 5a!cs rcvcnuc. This caIcuIalion does nol specify an
oulpul conlexl, so Wel InleIIigence assunes lhe defauIl conlexl and uses lhe dinensions vilh
vhich lhe neasuie appeais.
35 Working with Calculation ContextsLearner's Guide
As no oulpul conlexl is specified foi lhe 5um caIcuIalion, il assunes lhe conlexl of 5tatc.
Nntc: Il's inpoilanl lo undeisland lhal you can onIy sel lhe conlexl lo a IeveI lhal exisls vilhin lhe
dala piovidei of lhe docunenl. Ioi exanpIe, if you vanled lo change lhe defauIl conlexl lo caIcuIale
saIes ievenue al lhe cily IeveI, lhe CIty oljecl nusl exisl in lhe dala piovidei.
You cannol shov dala al lhe cily IeveI if lhe queiy does nol incIude lhis oljecl in lhe dala
piovidei.
Forcing the input caIcuIation context
You have seen hovlo use lhe defauIl caIcuIalion conlexl. You can deleinine vhal dinensions
viII le laken inlo accounl vhen caIcuIaling lhe aggiegale foi lhe foinuIa. This is iefeiied lo
as lhe inpul caIcuIalion conlexl. TypicaIIy, you vouId vanl lo use lhis vhen lhe caIcuIalion
needs lo lake inlo accounl specified dinensions lhal nay nol appeai in lhe iepoil, lul aie
conlained vilhin lhe dala piovidei.
Suppose lhal you vanl lo cieale an cFashInn iepoil lhal dispIays each slale, ils lolaI ievenue,
and lhe lesl ievenue evei achieved in any one yeai. To undeisland hov lo cieale a vaiialIe
lhal ieluins lhe lesl ievenue achieved in any one yeai ly slale, il heIps lo legin ly Iooking al
a iepoil lhal shovs saIes ievenue ly yeai, giouped ly slale.
The 5a!cs rcvcnuc coIunn is soiled in descending oidei, so lhe lop enliy in lhe 5a!cs rcvcnuc
coIunn is vhal you vouId Iike lo cieale a vaiialIe lo idenlify. Since you don'l vanl youi finaI
iepoil lo conlain a Ycar coIunn, you can nov inseil a nev lalIe lhal conlains onIy lhe 5tatc
and 5a!cs rcvcnuc oljecls.
Web ntelligence Advanced Report DesignLearner's Guide 36
Nov you jusl need lo cieale a vaiialIe lhal ieluins lhe slale's lesl yeai anounl and inseil il in
lhe nevlalIe. As youi fiisl allenpl, you nighl cieale a vaiialIe caIIed5tatc's bcst ycar amnunt,
using lhis synlax:
=max([Sales revenue])
If you add lhe nev vaiialIe lo lhe lalIe, you gel lhis iesuIl:
If you conpaie lhe slale's lesl yeai ievenue shovn in lhe fiisl lIock vilh lhe dala caIcuIaled
ly lhe vaiialIe you have jusl ciealed, you can see lhal lhe defauIl lehavioi of lhe caIcuIalion,
al lhe iov IeveI, is olviousIy nol lhe coiiecl conlexl.
y defauIl, Wel InleIIigence does nol knov lhal lhe Ycar oljecl needs lo le incIuded in lhe
conlexl of lhe caIcuIalion - il uses 5tatc as lhe conlexl lo caIcuIale lhe vaIues, and lhe iesuIl is
lhe exacl sane caIcuIalion lhal lhe 5a!cs rcvcnuc oljecl piojecls.
Nov, exlend lhe synlax lo specify lhe coiiecl inpul and oulpul conlexl so lhal Wel InleIIigence
knovs hov lo caIcuIale lhe dala coiieclIy. The synlax foi specifying inpul and oulpul conlexl
is:
Aggregate function([Measure] input_context) output_context
To exlend lhe synlax, lhe avaiIalIe opeialois aie:
- IoiLach
- In
37 Working with Calculation ContextsLearner's Guide
The key synlaclic diffeience lelveen an inpul and an oulpul conlexl is vheie lhe opeialoi is
pIaced. In an inpul caIcuIalion conlexl, lhe opeialoi is pIaced vilhin lhe liackels of lhe
aggiegale:
Synlax: Aggregate(measure FOREACH (dimension list))
Ioi exanpIe: =Max([Sales revenue] ForEach ([Year]))
Oi
Synlax: Aggregate(measure IN (dimensionlist))
Ioi exanpIe: =Max([Sales revenue] In ([Year]))
Suppose lhal you nodify lhe 5tatc's bcst ycar amnunt vaiialIe lo use lhis foinuIa:
=Max([Sales revenue] In ([Year]))
The iepoil nov Iooks Iike lhis:
This foinuIa does nol voik lecause aIlhough il incIudes Ycar in lhe caIcuIalion conlexl, il does
nol incIude 5tatc. Lven lhough lhe lalIe incIudes a 5tatc coIunn, and you vouId noinaIIy
expecl lhe dala lo aggiegale lo lhe slale IeveI, lhe Inopeialoi onIy lakes inlo accounl dinensions
in lhe foinuIa's dinension Iisl. Nov you can nodify lhe vaiialIe lo use lhis foinuIa:
=max([Sales revenue] In([Year] ; [State]))
The iepoil Iooks Iike lhis:
Web ntelligence Advanced Report DesignLearner's Guide 38
This foinuIa achieves lhe desiied iesuIl. y defauIl, Wel InleIIigence lakes |slalej as lhe oulpul
conlexl.
You can cieale an aIleinale foinuIa foi lhe vaiialIe ly using lhe IoiLach opeialoi inslead of
In. UnIike lhe In opeialoi, lhe IoiLach opeialoi lakes inlo accounl aII lhe dinensions in lhe
lalIe, so you can achieve lhe sane iesuIl using lhis foinuIa:
=max([Sales revenue] ForEach ([Year]))
About the extended syntax operators and keywords
The exlended synlax avaiIalIe lo iedefine lhe caIcuIalion conlexl of neasuies incIudes:
- Lxlended piojeclion conlexl opeialois, incIuding In, IoiLach, and IoiAII.
- Lxlended enviionnenl keyvoids, incIuding Repoil, Seclion, ieak, Iock, and ody. These
keyvoids aie used in foinuIas in conjunclion vilh lhe In conlexl opeialoi.
The conlexl opeialois lhal aie avaiIalIe lo iedefine lhe caIcuIalion conlexl of neasuies incIude:
Definition Operator
Used lo specify dinensions expIicilIy. AIso used vilh exlended
synlax keyvoids.
In
Specifies Iiniling condilions on lhe dala. Wheie
Adds dinensions lo lhe conlexl. IoiLach
Renoves dinensions fion lhe conlexl. IoiAII
The IoiAII and IoiLach opeialois aie usefuI vhen you have a defauIl conlexl vilh nany
dinensions. Il is oflen easiei lo "add" oi "sulliacl" fion lhe conlexl using IoiAII and IoiLach
lhan il is lo specify lhe Iisl expIicilIy using In.
39 Working with Calculation ContextsLearner's Guide
Forcing the output caIcuIation context
In lhe pievious exanpIes, you consideiedlhe inpul caIcuIalion conlexls. Thal is, you consideied
hov you vanled lhe neasuie lo aggiegale lased on lhe dinensions avaiIalIe in lhe lalIe and
lhe dala piovidei.
You can aIso deleinine lhe IeveI of aggiegalion al vhich lhe vaIue foi lhe vaiialIe is dispIayed
in lhe iepoil.
The exlended synlax keyvoids, Repoil, Seclion, ieak, Iock, and ody aie usefuI in defining
caIcuIalion conlexl. These keyvoids, used in conjunclion vilh lhe In opeialoi, aIIov you lo
change lhe defauIl conlexl fion lhe iov IeveI lo anolhei IeveI in lhe docunenl.
Suppose lhal you vanl lo cieale a iepoil lhal conlains an aIeilei vhich highIighls any sloie
vhose ievenue foi lhe yeai 2OO6 is Iovei lhan lhe aveiage ievenue of aII sloies in 2OO6. You
legin vilh lhis iepoil:
Nov you vanl lo cieale a foinuIa lhal ieluins lhe aveiage saIes ievenue, so you can use lhe
vaiialIe in youi aIeilei. If you cIick on lhe Aveiage vaIue in lhe foolei al lhe lollonof lhe lalIe
and Iook in lhe Fnrmu!a looIlai, you see lhal lhe foolei uses lhis caIcuIalion:
=Average([Sales revenue])
This caIcuIalion is geneiic, il has no inpul oi oulpul conlexl specified. Il ieluins a coiiecl aveiage
of ievenue eainedly sloies lecause no olhei specific conlexl vas defined. The caIcuIalion used
lhe defauIl conlexl of lhe lalIe foolei, vhich conlains caIcuIalions lased onIy on dala lhal
iesides in lhe lIock (lhe lalIe, in lhis case).
Nntc: If a iepoil fiIlei is appIied lo lhe lalIe, lhe defauIl conlexl in lhe lalIe foolei caIcuIales
onIy lhe vaIues ielained ly lhe fiIlei.
If you cieale an Avcragc vaiialIe using lhe sane synlax Wel InleIIigence used lo caIcuIale lhe
aveiage foi aII sloies, and add a nev Avcragc coIunn lo lhe lalIe, you gel lhis iesuIl:
Web ntelligence Advanced Report DesignLearner's Guide 40
The Avcragc vaiialIe appeais in lhe lalIe, lul lhe vaIues aie nov caIcuIaled al lhe iov IeveI
ialhei lhan al lhe vhoIe lalIe IeveI.
Why is lhis happening` The defauIl caIcuIalion conlexl has changed.
When lhe foinuIa =Average([Sales revenue]) is pIaced in:
- The foolei: lhe conlexl is lo caIcuIale foi lhe enliie lalIe.
- The lalIe: lhe conlexl is lo caIcuIale foi each individuaI iov.
If you liy lo luiId an aIeilei lo highIighl vaIues in lhe 5a!cs rcvcnuc coIunn lhal aie leIov
lhe aveiage, lhe aIeilei viII nol voik since lhe 5a!cs rcvcnuc vaIues aie cuiienlIy equaI lo lhe
Avcragc vaIues.
To soIve lhis, you can use eilhei lhe IoiAII oi lhe In Iock opeialois, using lhe foIIoving synlax:
Aggregate(measure) ForAll(dimensionlist))
Ioi exanpIe: =Average([Sales revenue]) ForAll ([Store name];[Year])
Oi
Synlax: Aggregate(measure) In Block
Ioi exanpIe: =Average([Sales revenue]) In Block
The diffeience lelveen lhe lvo is lhal lhe IoiAII opeialoi onIy aggiegales lhe neasuie foi lhe
dinensions in lhe dinension Iisl, vhiIe lhe In opeialoi aggiegales al lhe iepoil enviionnenl
IeveI, lhal is, al lhe lody, lIock oi iepoil IeveI.
The key diffeience is lhal vhen you use lhe In opeialoi, lhe foinuIa caIcuIalion is aggiegaled
al lhe specified IeveI iegaidIess of vhich dinensions oi vaiialIes aie used in lhe iepoil.
If you updale lhe Avcragc foinuIa lo use lhe =Average([Sales revenue]) In Block foinuIa,
lhe iepoil Iooks Iike lhis:
41 Working with Calculation ContextsLearner's Guide
Why use lhis synlax`
y adding In Iock as lhe oulpul conlexl, you aie specifying lhal lhe caIcuIalion shouId le
dispIayed al lhe lIock (vhoIe lalIe) IeveI, even lhough lhe caIcuIalion vas pIaced al lhe iov
IeveI.
Why is lheie no inpul conlexl`
No inpul conlexl is needed since lhe caIcuIalion needs lo find lhe aveiage lased on lhe enliie
lalIe. y Ieaving lhe inpul conlexl lo assune lhe defauIl, you ensuie lhal no addilionaI oljecls
aie consideied vhen lhe aveiage is caIcuIaled.
Novlhal lhe Avcragc vaiialIe uses lhe coiiecl foinuIa, you can cieale lhe aIeilei lo highIighl
leIov aveiage iesuIls pei sloie.
If you appIy lhis aIeilei lo lhe 5tnrc namc coIunn in lhe iepoil, and ienove lhe Avcragc
coIunn, you gel lhe iesuIls you iequiie:
Web ntelligence Advanced Report DesignLearner's Guide 42
More about the extended syntax keywords
The foIIoving keyvoids canle usedvilhlhe Inopeialoi lo conlioI hovneasuies aie caIcuIaled
al diffeienl IeveIs vilhin lhe docunenl: Repoil, Seclion, ieak, Iock, and ody.
Effect Environment LeveI
The piojecledvaIue of lhe neasuie is aggiegaledfoi aII dinensions
conlained vilhin lhe page of lhe iepoil.
Repoil
The piojecledvaIue of lhe neasuie is aggiegaledfoi aII dinensions
conlained vilhin lhe seclion of lhe iepoil.
Seclion
The piojecledvaIue of lhe neasuie is aggiegaledfoi aII dinensions
conlained vilhin lhe lieak of lhe lalIe.
ieak
The piojecled vaIue of lhe neasuie is aggiegaled acioss aII vaIues
foi dinensions conlained vilhin lhe lIock.
Iock
The piojecledvaIue of lhe neasuie is aggiegaledfoi aII dinensions
al lhe IeveI in lhe iepoil lhal il is pIaced.
ody
Input vs. output caIcuIation contexts
In sunnaiy, unIess you need lhe aggiegale of a neasuie lo lake inlo accounl a dinension lhal
is in lhe dala piovidei lul nol in lhe lalIe, an oulpul caIcuIalion viII suffice.
43 Working with Calculation ContextsLearner's Guide
When specifying an oulpul caIcuIalion conlexl, il is noinaIIy lesl lo use lhe In opeialoi as lhis
is noie fIexilIe and viII nol need lo le changed if lhe dinensions of lhe enviionnenl aie
aIleied.
ConveiseIy, vhen specifying an inpul caIcuIalionconlexl, il is noinaIIy lellei lo use lhe IoiLach
opeialoi as il viII aulonalicaIIy lake inlo accounl lhe dinensions in lhe lIock.
Using the In context operator with Where
Tvo of lhe nosl videIy-used opeialois used lo specify lolh inpul and oulpul conlexls aie In
and Wheie. AIlhough each opeialoi denoles a diffeienl lype of caIcuIalion enviionnenl, lhe
lvo nay le used logelhei in a singIe vaiialIe.
The In opeialoi specifies aII paianeleis (dinension oljecls) lhal aie lo le incIuded in lhe
conlexl. When using nuIlipIe dinension oljecls, lhe dinensions shouId le Iisled in oidei of
gianuIaiily and nusl le sepaialed vilh ",".
The Wheie opeialoi insliucls lhe vaiialIe lo caIcuIale onIy vheie ceilain vaIues aie liue.
Suppose lhal you need lo pioduce a iepoil lhal caIcuIales lolh lhe highesl saIes ievenue foi
aII slales as veII as specific infoinalion foi CaIifoinia. You slail oul ciealing a queiy incIuding
lhe Ycar, 5tatc, and 5a!cs rcvcnuc oljecls, and ienove lhe 5tatc coIunn fionlhe lalIe so lhal
youi iepoil Iooks Iike lhis:
Web ntelligence Advanced Report DesignLearner's Guide 44
Nov you can cieale a 5a!cs rcvcnuc By Ycar fnr Ca!IfnrnIa vaiialIe using lhis synlax:
=[Sales revenue] Where ([State]="California")
This conlexl uses lhe Wheie opeialoi lo isoIale lhe CaIifoinia slale in lhe caIcuIalion. If you
iepIace lhe 5a!cs rcvcnuc coIunn vilh lhis nev vaiialIe, and appIy sone foinalling lo lhe
lalIe, il Iooks Iike lhis:
Nov you vanl lo cieale a vaiialIe lo find lhe highesl ievenue foi any one slale. You can use
lhis synlax:
=Max([Sales revenue] In([State]))
This conlexl uses lhe In opeialoi lo specify inpul conlexl. This assuies lhal lhe caIcuIalion onIy
addiesses lhe 5tatc vaIues vhen Iocaling a naxinun anounl.
Theie is no oulpul conlexl defined, so lhe caIcuIalion uses lhe defauIl oulpul conlexl of lhe
enliie iepoil, lecause il vas pIaced al lhe iepoil IeveI ialhei lhan in a lalIe.
Nexl you can cieale a HIghcst annua! rcvcnuc fnr Ca!IfnrnIa vaiialIe using lhe foIIoving
synlax:
=Max([Sales revenue] In([State];[Year]) Where([State] ="California"))
This vaiialIe definilion uses lolh lhe In andWheie opeialois lo achieve lhe coiiecl caIcuIalion.
olh opeialois veie used in defining lhe inpul conlexl.
- The In opeialoi foices lhe =Max opeialoi lo Iook in lhe 5tatc vaIues fiisl and lhen lhe Ycar
vaIues vilhin each 5tatc in oidei lo Iocale lhe naxinun vaIue.
- The Wheie opeialoi assuies lhal lhe =Max caIcuIalion is onIy vaIid vheie lhe slale is
CaIifoinia.
IinaIIy, you can cieale a 5a!cs rcvcnuc fnr Ca!IfnrnIa fnr thc 2006 vaiialIe using lhis synlax:
=[Sales revenue] Where([State]="California" And [Year] ="2006")
Like lhe 5a!cs rcvcnuc By Ycar fnr Ca!IfnrnIa vaiialIe, lhis caIcuIalion uses lhe Wheie opeialoi
in lhe inpul conlexl lo ensuie lhal lhe caIcuIalion is vaIid foi onIy lhose vaIues denoled ly lhe
Wheie opeialois.
Il is nol necessaiy lo Iisl lhe conponenls of lhe caIcuIalion in oidei of gianuIaiily vhen using
lhe Wheie opeialoi. You nusl Iisl lhe conponenls vhen using lhe In opeialoi.
The foIIoving lalIe shovs synlax and exanpIes foi lhe Wheie opeialoi.
45 Working with Calculation ContextsLearner's Guide
5yntax and Examp!cs: DcscrIptInn: Opcratnr:
[measure_expression] Where [boolean_expression] Resliicls lhe dala
used lo caIcuIale
Wheie
The foinuIa Aveiage ([Sales Revenue]) Where ([Country]
= "US") caIcuIales lhe aveiage saIes vheie lhe counliy is "US".
lhe neasuie
expiession.
The foinuIa Average ([Sales Revenue]) Where ([Country]
= "US" Or [Country] = "France") caIcuIales lhe aveiage saIes
vheie lhe counliy is "US" oi "Iiance".
The foinuIa [Revenue] Where (Not ([Country] Inlist
("US";"France"))) caIcuIales lhe ievenue foi lhe counliies
olhei lhan US and Iiance.
The vaiialIe [High Revenue] has lhe foinuIa [Revenue] Where
[Revenue> 500000].
When pIaced in a lIock, [High Revenue] dispIays eilhei lhe
ievenue vhen ils vaIue is giealei lhan 5OOOOO, oi nolhing.
When pIaced in a foolei al lhe lollon of lhe [High Revenue]
coIunn, lhe foinuIa Average ([High Revenue]) ieluins lhe
aveiage of aII lhe ievenues giealei lhan 5OOOOO.
Nntc: You can use lhe looIean opeialois vilh lhe Whcrc opeialoi.
Important facts about caIcuIation contexts
- If you do nol define an inpul oi oulpul conlexl, Wel InleIIigence assunes lhe defauIl conlexl
of vheie lhe caIcuIalion has leen pIaced.
- When using vaiialIes as lhe lasis of an aIeilei (as in lhe Aveiage exanpIe jusl seen), il is
necessaiy lo ensuie lhal lhe caIcuIalion has leen ciealed as a vaiialIe (lhal is, a foinuIa
vilh a nane), and nol as a sinpIe foinuIa.
Nntc: If lhe caIcuIalion is a foinuIa, shovlhe Fnrmu!a looIlai, lhen cIick lhe Crcatc VarIab!c
lullon in oidei lo save il as a vaiialIe.
- When using lhe Wheie opeialoi, il is necessaiy lo pIace paienlheses aiound lhe vaIues Iisled
aflei lhe Wheie , as in lhe foIIoving exanpIe:
=[Sales revenue] Where ([Year] = "2004)
Activity: CaIcuIation contexts
Objective
- Use exlended synlax lo iedefine lhe caIcuIalion conlexl of neasuies in a Wel InleIIigence
docunenl.
Web ntelligence Advanced Report DesignLearner's Guide 46
Instructions
1. Cieale a docunenl lhal shovs in a singIe lIock:
- SaIes ievenue foi each eIashion sloie.
- TolaI saIes ievenue foi aII sloies.
- Aveiage ievenue foi aII sloies.
- HighIighl lhose sloies vhose ievenue vas alove lhe aveiage ievenue foi aII sloies.
2. Change lhe nane of lhe iepoil lo Rcvcnuc InfnrmatInn fnr A!! 5tnrcs.
3. Save lhe docunenl as Act_Ca!cu!atInncnntcxt.
Youi docunenl shouId Iook Iike lhis exanpIe:
Activity: CaIcuIation contexts - OptionaI
Objective
- Use exlended synlax lo iedefine a caIcuIalion conlexl of neasuies in a Wel InleIIigence
docunenl.
Instructions
1. Cieale a docunenl lhal shovs in a singIe lIock:
- 5a!cs rcvcnuc pei Ycar, lioken dovn ly 5tnrc namc.
47 Working with Calculation ContextsLearner's Guide
- The naxinun ievenue pei sloie, ovei lhe lhiee yeai peiiod.
- HighIighl lhe sloie nane vhen lhis naxinun ievenue vaIue is giealei lhan $1,OOO,OOO.
2. Save lhe docunenl as Act_Ca!cu!atInncnntcxt_2.
Youi docunenl shouId Iook Iike lhis exanpIe:
Web ntelligence Advanced Report DesignLearner's Guide 48
Quiz: CaIcuIation Contexts
1. Whal is an inpul conlexl`
2. Whal is an oulpul conlexl`
3. Which of lhe foIIoving is an exlended synlax conlexl opeialoi`
NoIiIlei()
IoiLach
Iock
4. Which of lhe foIIoving is an exlended synlax keyvoid`
NoIiIlei()
IoiLach
Seclion
49 Working with Calculation ContextsLearner's Guide
Lesson summary
Aflei conpIeling lhis Iesson, you aie nov alIe lo:
- Undeisland caIcuIalion conlexls
- Redefine caIcuIalion conlexls
Web ntelligence Advanced Report DesignLearner's Guide 50
Lesson 4
Creating FormuIas with Character and Date String
Functions
Lesson introduction
The aliIily lo cieale foinuIas and define lhenas vaiialIes in Wel InleIIigence offeis lhe iepoil
designei a veiy poveifuI looI. VaiialIes acl jusl Iike dinension oi neasuie oljecls. Once you
have ciealed a vaiialIe, you can use il lhioughoul lhe docunenl lo dispIay dala lhal you cannol
ieliieve ly using lhe exisling oljecls in lhe univeise.
Inlhis Iesson, youIeainaloul sone of lhe foinuIa funclions avaiIalIe foi nanipuIaling chaiaclei
and dale vaiialIes. WhiIe lhe synlax nay lake sone line lo conpiehend, il is veII voilh lhe
effoil as vaiialIes can piovide you vilh noie fIexiliIily in iepoiling.
Nntc: Ioi noie infoinalion aloul ciealing foinuIas and defining lhen as vaiialIes, iefei lo
lhe 8usincssOojcc|s lco |n|c||igcncc X| 3.0/3.1. Rcpcr| Dcsign couise.
Aflei conpIeling lhis Iesson, you viII le alIe lo:
- Use chaiaclei sliings
- Use lhe Righl() funclion
- Use lhe RepIace() funclion
- Use lhe SulSli() funclion
- Use lhe Ios() funclion
- Concalenale diffeienl chaiaclei sliings
- Use dale funclions
51 Creating Formulas with Character and Date String FunctionsLearner's Guide
Using character strings
Achaiaclei sliing is a seiies of chaiacleis lhal foineilhei a piece of lexl oi lhe individuaI vaIues
of a chaiaclei-lype vaiialIe. They aie aIvays calegoiized as dinension oljecls, lul lhe ieveise
is nol liue. A dinension oljecl can le of chaiaclei, dale, oi nuneiic lype.
Using Wel InleIIigence chaiaclei-sliing funclions, you can iepIace, nodify, oi ienove eilhei
aII oi pail of a chaiaclei sliing.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Desciile lhe chaiaclei-sliing funclions piesenled in lhis Iesson
About character-string functions
The chaiaclei-sliing funclions piesenled in lhis Iesson aie:
- Righl() - used lo exliacl a given nunlei of chaiacleis fion lhe iighl
- RepIace() - used lo iepIace a specified sliing vilh anolhei sliing
- Lefl() - used lo exliacl a given nunlei of chaiacleis fion lhe Iefl
- SulSli() - used lo exliacl a sliing fion vilhin a sliing using vaiialIe Ienglh and posilion
- Lenglh() - used lo idenlify lhe Ienglh of a sliing
- Ios() - used lo idenlify lhe posilion of a chaiaclei in a sliing
RepIace() , Righl(), and Lefl() aie onIy usefuI vhen you vanl lo nanipuIale a conslanl sliing
oi a conslanl nunlei of chaiacleis. SulSli() is a noie poveifuI funclion. You viII use lhe
SulSli() funclion lo exliacl sliings vheie lhe Ienglh and posilion aie nol consislenl.
Using functions in formuIas and variabIes
You use lhe funclions piesenled in lhis Iesson vhen you aie ciealing a foinuIa. You can cieale
a foinuIa ly lyping il in lhe Fnrmu!a lai oi in lhe Fnrmu!a EdItnr . Lilhei nelhod caIcuIales
lhe dala and dispIays lhe iesuIling vaIues in lhe coIunn lhal you have highIighled in lhe lIock.
You can aIso diag and diop oljecls in lhe Fnrmu!a lai and lhen conpIele lhe foinuIa ly lyping
in lhe Fnrmu!a lai.
If youvanl lo use lhe foinuIa iepealedIy in diffeienl lIocks oi diffeienl iepoils in lhe docunenl,
oi if you vanl lo idenlify lhe foinuIa as lhough il veie an oljecl in lhe docunenl, you can
define lhe foinuIa as a vaiialIe.
If you onIy vanl lo dispIay lhe caIcuIaled vaIue in a singIe ceII, lhen ciealing a foinuIa is lesl.
Hovevei, if you vanl lo dispIay lhe iesuIl as a coIunn in a iepoil lIock, lhen defining lhe
foinuIa as a vaiialIe is lesl.
If in doull, aIvays cieale a vaiialIe ialhei lhan a foinuIa, as lheie aie ceilain lhings lhal cannol
le done vilh a foinuIa lhal can le done vilh a vaiialIe.
Web ntelligence Advanced Report DesignLearner's Guide 52
Using the Right() function
The Righl() funclion dispIays a fixed nunlei of chaiacleis slailing fion lhe iighl end of lhe
chaiaclei sliing and ienoves lhe olheis.
The synlax foi lhe Righl() funclion is:
string Right(string input_string; integer number_of_characters)
input_string iefeis lo lhe sliing fion vhich you vanl lo seIecl chaiacleis lo dispIay.
number_of_characters sels lhe nunlei of chaiacleis lo dispIay fion lhe iighl of lhe inpul
sliing.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Use lhe Righl() funclion lo dispIay seIecled chaiacleis fion a chaiaclei sliing
How to extract characters using the Right() function
Suppose lhal you aie voiking vilh lhis iepoil:
The Ycar oljecl in lhe cFashInn univeise is foinalled lo ieluin lhe yeai as a foui-digil nunlei
(foi exanpIe, 2OO4). Hovevei, you need lo dispIay lhe yeai in lvo-digil foinal (foi exanpIe,
O4). To do lhis, you can use lhe Righl() chaiaclei sliing funclion lo ienove lhe fiisl lvo digils
and dispIay lhe Iasl lvo.
Cieale a nev vaiialIe caIIed Ycars, using lhis synlax:
=Right([Year] ; 2)
vheie:
53 Creating Formulas with Character and Date String FunctionsLearner's Guide
Description Syntax
The nane of lhe oljecl lhal ieliieves lhe dala.
[Year]
The nunlei of chaiacleis lo dispIay fionlhe
iighl of lhe chaiaclei sliing.
2
Nntc: The Lefl chaiaclei sliing funclion voiks in exaclIy lhe sane vay excepl lhal lhe funclion
dispIays lhe specified nunlei of chaiacleis slailing fion lhe Iefl.
When you diop lhe Ycars vaiialIe in lhe seclion headei lIock, lhe iepoil Iooks Iike lhis:
To fuilhei cIaiify lhe seclion headei, you can nodify lhe Ycars foinuIa lo use lhis synlax:
=NameOf ([Year]) + " " + Right([Year] ; 2)
vheie:
Description Syntax
To dispIay lhe nane of lhe Ycar oljecl.
NameOf([Year](
To concalenale a space aflei lhe oljecl nane.
+
To concalenale and dispIay lvo chaiacleis slailing fion lhe iighl
end of lhe chaiaclei sliing.
+ Right ([Year]) ;
2 )
The iepoil Iooks Iike lhis:
Web ntelligence Advanced Report DesignLearner's Guide 54
55 Creating Formulas with Character and Date String FunctionsLearner's Guide
Using the RepIace() function
The RepIace() funclion iepIaces a specified sliing vilh anolhei sliing.
The synlax foi lhe iepIace funclion is:
string Replace(string input_string; string string_to_replace; string
replace_string)
input_string The inpul sliing.
string_to_replace The sliing vilhin inpul_sliing lo le iepIaced.
replace_string The sliing lo iepIace sliing_lo_iepIace vilh.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Use lhe Rcp!acc() funclion lo iepIace Q vilh lhe void Quailei
RepIacing a string
Suppose lhal you need lo iepoil on quaileiIy ievenue using lhe void Quailei inslead of Q in
lhe iepoil.
You can cieale a vaiialIe using lhe RepIace() funclion lo nodify lhe chaiaclei sliing dispIayed
in lhe iepoil using lhis foinuIa:
=Replace([Quarter] ; Q ; Quarter )
vheie:
Description Syntax
The nane of lhe oljecl lhal ieliieves lhe dala. |Quaileij
Web ntelligence Advanced Report DesignLearner's Guide 56
Description Syntax
The vaIue sloied in lhe dalalase, foIIoved
ly 1 lhiough 4 lo indicale lhe fiisl lhiough
fouilh quaileis of lhe yeai.
Q
The chaiaclei sliing lhal viII iepIace Q in
eveiy inslance.
Quailei
Nntc: e suie lo add a space aflei lhe void Quailei
and lefoie lhe end-quole.
If you iepIace lhe Quailei coIunn vilh lhe nev vaiialIe you ciealed, you gel lhis iesuIl:
57 Creating Formulas with Character and Date String FunctionsLearner's Guide
Using the SubStr() function
The SulSli() funclion exliacls a specified chaiaclei sliing fion vilhin a sliing.
The synlax foi lhe SulSli() funclion is:
string Substr(string input_string; integer start; integer length)
input string is lhe sliing fion vhich lhe sulsliing is lo le exliacled.
start is lhe posilion of lhe fiisl chaiaclei in lhe inpul sliing lo le exliacled (foi exanpIe, 1).
length is lhe nunlei of chaiacleis (fion lhe iniliaI posilion foivaid) lo le exliacled.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Use lhe 5ub5tr() funclion lo exliacl a chaiaclei sliing fion vilhin a sliing
How to extract characters using the SubStr() function
The 5tnrc namc oljecl in lhe cFashInn univeise ieluins lhe nane of each sloie in lhe conpany,
lul piefaces each one vilh "e-Iashion".
Suppose lhal you vanl lo ienove lhe e-Iashion poilion of lhe chaiaclei sliing. This piesenls
a chaIIenge since lhe Ienglh of each sloie's nane is diffeienl, vilh oi vilhoul lhe "e-Iashion"
poilion. Neilhei lhe Righl() oi Lefl() funclions viII voik heie.
The easiesl vay lo achieve lhe ienovaI is lo use lhe SulSli() funclion. Cieale a vaiialIe caIIed
5tnrc, and use lhis synlax:
=SubStr([Store name] ; 11 ; Length([Store name]))
Why`
- "11" iepiesenls lhe slailing poinl al vhich lhe foinuIa is lo slail dispIaying chaiacleis. This
vas eslalIished ly counling lhe nunlei of chaiacleis in "e-Iashion" (9) and lhen adding a
Web ntelligence Advanced Report DesignLearner's Guide 58
chaiaclei lo accounl foi lhe space lelveen lhe void "e-Iashion" and each sloie nane (1O).
Theiefoie you vanl lhe slailing poinl lo le chaiaclei 11.
- The Lenglh() funclion ieluins lhe Ienglh of lhe oiiginaI sloie nane, incIuding lhe e-Iashion
pail of lhe nane.
Nntc: Donl foigel lhal lhe leginning nunlei in lhe SulSli() funclion is lhe leginning chaiaclei
posilion lhal you vanl lhe sulsliing lo slail dispIaying chaiacleis. Chaiaclei posilions idenlified
in lhe SulSli() synlax aie lhose you vanl lo see dispIayed, nol lhose you vanl lo ienove.
If you iepIace lhe 5tnrc namc coIunn vilh lhe 5tnrc coIunn, lhe iepoil Iooks Iike lhis:
59 Creating Formulas with Character and Date String FunctionsLearner's Guide
Using the Pos() function
The Ios() funclion idenlifies lhe fiisl inslance of a unique chaiaclei and ieluins lhe nunlei of
chaiacleis fion lhe slail of a sliing lo lhal inslance of lhe chaiaclei.
The synlax foi lhis funclion is:
integer Pos(string input_string; string pattern)
input_string defines lhe sliing lo le seaiched foi lhe occuiience of a chaiaclei and il's posilion
in lhe sliing.
pattern is lhe chaiaclei sliing you vish lo seaich foi.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Use lhe Ios() funclion lo ieluin lhe posilion of a specific chaiaclei sliing
How to use the Pos() function
Suppose lhal you aie voiking on a iepoil conlaining lhese coIunns:
In lhe addiess coIunn, you vanl lo dispIay onIy lhe slieel nanes foi each of lhe eIashion
sloies. The Addrcss oljecl fion lhe univeise ieluins lolh lhe luiIding nunlei and lhe slieel
nane, and lhe nunlei of spaces lefoie lhe slieel nane legins is inconsislenl. Theiefoie, you
nusl cieale a sulsliing lo ieluin onIy lhe poilion of lhe addiess lhal is needed.
Nolice lhal in each addiess lheie is a space aflei lhe luiIding nunlei. If youcan cieale a foinuIa
lhal iecognizes al vhal posilion lhe space Iies foi each vaIue, you can use lhal posilion as a
slailing poinl foi lhe SulSli() funclion.
Cieale a vaiialIe caIIed 5pacc, using lhis synlax:
Syntax: =Pos([Address] ; " ")
Web ntelligence Advanced Report DesignLearner's Guide 60
This vaiialIe Iocales lhe fiisl space vilhin each addiess sliing. If you add a 5pacc coIunn lo
lhe iepoil, you gel lhis iesuIl:
The inlegei ieluined ly lhe 5pacc vaiialIe coiiesponds lo lhe nunlei of chaiacleis lefoie lhe
slieel addiess legins. Nov you can cieale a nev vaiialIe caIIed 5tnrc Addrcss, lhal ienoves
lhe luiIding nunlei fion lhe addiess sliing. Use lhis synlax:
=SubStr([Address] ; [Space]+1 ; Length([Address]))
Why`
- The 5pacc vaiialIe sils al lhe 'leginning nunlei' sIol of lhe SulSli() funclion's synlax. Il
conlains lhe vaiialIe nane and lhe lexl pallein you vanl lo Iocale (a space in lhis case).
- The +1 leIIs lhe funclion lo legin lhe sulsliing al one posilion noie lhan lhe Iocalion of lhe
space so lhal lhe space is nol ieluined.
- The Lenglh() funclion insliucls lhe syslen lhal lhe nunlei of chaiacleis lo le dispIayed
fion each Addiess sliing is equaI lo lhe Ienglh of each addiess aflei lhe chaiaclei (a space
in lhis case) in lhe leginning nunlei posilion.
If you deIele lhe 5pacc coIunn fionlhe iepoil, and iepIace lhe Addrcss coIunn vilh lhe 5tnrc
Addrcss vaiialIe you jusl ciealed, you gel lhe iesuIl you iequiie:
61 Creating Formulas with Character and Date String FunctionsLearner's Guide
Concatenating different character strings
The chaiaclei used lo Iink lvo sliings logelhei in a foinuIa, oi concalenale dala, is lhe pIus
synloI "+". The synlax is:
"String1 + "String2
Nntc: You can concalenale as nany sliings logelhei as you Iike.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Conline lvo sliings in a foinuIa using lhe concalenale funclion
- Ioinal a dale vhen il is concalenaled vilh a sliing
How to concatenate a string with a date
To expIoie concalenaling diffeienl dala lypes, considei conlining a sliing vaIue vilh lhe Last
Rcfrcsh Datc fiee-slanding ceII foinuIa.
The Last Rcfrcsh Datc fiee-slanding ceII dispIays lhe dale and line lhal lhe docunenl vas
Iasl execuled:
The synlax foi lhe foinuIa of lhe ceII is:
date LastExecutionDate(string data_provider)
Nntc: This foinuIa ieluins lhe dale on vhich a dala piovidei, oi queiy, vas Iasl iefieshed. If youi
iepoil has one dala piovidei onIy, you can onil lhe |dala_piovideij paianelei. You nusl encIose
lhe nane of lhe dala piovidei in squaie liackels.
If you inseil lhe Last Rcfrcsh Datc fiee-slanding ceII inlo a iepoil and viev lhe foinuIa in lhe
Fnrmu!a EdItnr, you see lhis:
=LastExecutionDate()
To inseil a desciiplive sliing piioi lo lhe dale, you can nodify lhe foinuIa Iike lhis:
="Last Execution Date: "+LastExecutionDate()
This foinuIa concalenales lhe "Lasl Lxeculion Dale" chaiaclei sliing vilh lhe
LaslLxeculionDale() funclion. The Last Rcfrcsh Datc ceII nov Iooks Iike lhis:
Formatting a date that is concatenated with a string
You have seen hovlo concalenale a dale vilh a sliing. Novyou vanl lo dispIay lhe dale using
a chaiaclei sliing as veII.
Web ntelligence Advanced Report DesignLearner's Guide 62
NoinaIIy, if you had nol incIuded lhe chaiaclei sliing Lasl Lxeculion Dale in lhe foinuIa, you
couId iighl-cIick lhe ceII and seIecl lhe Fnrmat Numbcr ilen fion lhe diop-dovn nenu.
Then you vouId seIecl lhe dale foinal of youi choice fionlhe Datc/TImc zone of lhe Numbcr
Fnrmat diaIog lox. Hovevei, nov lhal you have ediled lhe foinuIa lo add a chaiaclei sliing,
you can no Iongei use lhe slandaid foinalling nelhod. To foinal a dale so lhal il is dispIayed
as a sliing vhen il is concalenaled vilh anolhei sliing, you use lhe IoinalDale() funclion. The
synlax foi lhis funclion is:
string FormatDate(date date_to_format; string date_format)
Ioi exanpIe:
FormatDate([Start Date] ;"dd/MM/yyyy")
Ioi exanpIe, if you nodify lhe Lasl Refiesh Dale foinuIa lo use lhe IoinalDale() funclion,
using lhis synlax:
="Last Execution Date: " + FormatDate(LastExecutionDate() ; "Mmmm dd, yyyy")
The dale nov dispIays Iike lhis:
63 Creating Formulas with Character and Date String FunctionsLearner's Guide
Nntc: To conveil a nunlei lo a sliing you can use lhe Ioinal nunlei() funclion. The synlax foi
lhis funclion is:
string Format number(number number_to_format; string number_format)
Web ntelligence Advanced Report DesignLearner's Guide 64
Using date functions
The lhiee nosl connonIy used dale funclions aie:
- ToDale: changes lhe dala lype of a vaIue lo dale
- CuiienlDale: gives lhe dale loday
- Dayselveen: caIcuIales lhe nunlei of days lelveen lvo dales
In lhis unil, you viII considei lhe piocess of conveiling a sliing lo a dale as dales aie oflen
foinalled as chaiaclei lype al eilhei lhe dalalase oi univeise IeveI.
You viII use aII of lhese dale funclions lo cieale a vaiialIe naned Tiading Yeais.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Use dale funclions lo cieale a vaiialIe
- Conveil a chaiaclei sliing lo a dale vaIue
Converting a string to a date vaIue
In lhe cFashInn univeise, lheie is no oljecl foi nunlei of yeais liading. The univeise onIy has
lhe OpcnIng Datc dinension oljecl.
Nntc: The vaIues ieluined ly lhe OpcnIng Datc oljecl aie dispIayed in lhe foinal "MM/dd/yy
hh:nn:ss AM."
Suppose lhal you vanl lo cieale a vaiialIe lhal caIcuIales lhe nunlei of yeais lhal sloies have
leen liading, lased on lhe dale lhe sloies opened.
If you iighl-cIick lhe OpcnIng Datc oljecl in lhe Data lal, you see lhal il is a sliing.
65 Creating Formulas with Character and Date String FunctionsLearner's Guide
efoie you can caIcuIale lhe liading yeais you need lo sliip oul lhe line eIenenl of lhe sliing
and lhen conveil il lo a dale lype. Then you viII le alIe lo peifoin a dale caIcuIalion lo
deleinine lhe diffeience lelveen loday's dale and lhe opening dale.
You can use lhe Sulsli() funclion lo sliip oul lhe line eIenenl of lhe sliing. Hovevei, lhe dale
eIenenl is nol in a conslanl foinal (foi exanpIe, sone days and nonlhs aie expiessed as singIe
digils vhiIe olheis aie lvo digils).
Since lhe dale is aIvays foIIoved ly a space you can use lhe Ios() funclion lo define lhe nunlei
of chaiaclei eIenenls of lhe Sulsli() synlax. You can cieale a vaiialIe caIIed Datc_5ubstrIng
lased on lhis foinuIa:
=SubStr([Opening date] ; 1 ; Pos([Opening date] ;" ")-1)
Then you can cieale anolhei vaiialIe caIIed Open_Dale lo conveil lhe Dale_ Sulsliing vaIues
lo dale lype using lhis foinuIa.
=ToDate([Date_Substring] ; "MM/dd/yy")
Nntc: The dale nusl le foinalled in lhe sane vay as lhe sliing lhal is leing conveiled. Ioi inslance,
if lhe oidei of lhe dales in lhe sliing is Monlh/Day, lhen lhe dale nusl le foinalled lhe sane vay.
If lhe oidei of lhe dales in lhe sliing is Day/Monlh hovevei, lhen lhe foinuIa nusl use lhal foinal
as veII. If you iepIace lhe OpcnIng Datc coIunn in lhe iepoil vilh lhe Opcn_Datc vaiialIe, lhe
coIunn Iooks Iike lhis:
Using date caIcuIations
Nov lhal you have ciealed a dale lype vaiialIe foi lhe sloie opening dale, you can caIcuIale
lhe nunlei of days lo lhe cuiienl dale using lhe CuiienlDale() and Dayselveen() funclions.
The synlax of lhe Dayselveen() funclion is:
integer DaysBetween(date first_date; date last_date)
first_date The oIdesl dale.
last_date The nosl iecenl dale.
Web ntelligence Advanced Report DesignLearner's Guide 66
You can cieale a vaiialIe caIIed TradIng_Ycars using lhis foinuIa:
=DaysBetween([Open_Date] ; CurrentDate())/365.25
Nntc: To conveil lhe days lo yeais, you nusl divide ly lhe nunlei of days in a yeai and in so
doing lake accounl of Ieap yeais. Hence, lhe dale caIcuIalion is divided ly 365.25 days.
If you iepIace lhe Opcn_Datc coIunn vilh lhe TradIng_Ycars vaiialIe you jusl ciealed, you
achieve lhe iequiied iesuIl:
Activity: Character and date string functions
Objective
- Use lhe SulSli() funclions in conjunclion vilh lhe Lenglh() funclion lo do high-IeveI sliing
foinalling.
Instructions
Cieale a iepoil shoving lhe yeai lhal each eIashion sloie opened.
1. Cieale a iepoil using lhe cFashInn univeise and seIecl lhe foIIoving oljecls:
OpcnIng Datc and 5tnrc namc
2. Using lhe OpcnIng Datc oljecl as lhe lasis foi lhe foinuIas, cieale nev vaiialIes so lhal
lhe finaI iepoil dispIays sinpIy lhe yeai lhal each sloie opened, nol lhe exacl dale and line.
67 Creating Formulas with Character and Date String FunctionsLearner's Guide
Youi iepoil appeais Iike lhis:
Nntc: The Ycar npcncd oljecl is foinalled as a nunlei, nol a dale, so you nusl foinal lhe
nunlei lo dispIay vilhoul a conna lo achieve lhe desiied iesuIl.
3. Save lhe iepoil as Act_YearOpened.
Activity: Character and date string functions - 2
Objective
- Use lhe SulSli() funclion in conjunclion vilh lhe Lenglh() funclion lo do high-IeveI sliing
foinalling.
Instructions
Cieale a iepoil shoving lhe naigin peifoinance acioss aII eIashion sloies.
1. Cieale a iepoil using lhe cFashInn univeise and seIecl lhe foIIoving oljecls:
5tatc, 5tnrc namc, QuantIty 5n!d, 5a!cs Rcvcnuc, MargIn
2. AppIy a sun lo aII neasuies.
3. Theie is a Iol of iepelilion in lhe 5tnrc namc coIunn. Cieale a vaiialIe caIIed 5tnrc lo ienove
lhe eIashion fion lhe 5tnrc namc.
4. Save lhe iepoil as Act_characterdatestring.
Web ntelligence Advanced Report DesignLearner's Guide 68
Youi iepoil appeais Iike lhis:
Converting a string to a date vaIue
In lhe cFashInn univeise, lheie is no oljecl foi nunlei of yeais liading. The univeise onIy has
lhe OpcnIng Datc dinension oljecl.
Nntc: The vaIues ieluined ly lhe OpcnIng Datc oljecl aie dispIayed in lhe foinal "MM/dd/yy
hh:nn:ss AM."
Suppose lhal you vanl lo cieale a vaiialIe lhal caIcuIales lhe nunlei of yeais lhal sloies have
leen liading, lased on lhe dale lhe sloies opened.
If you iighl-cIick lhe OpcnIng Datc oljecl in lhe Data lal, you see lhal il is a sliing.
69 Creating Formulas with Character and Date String FunctionsLearner's Guide
efoie you can caIcuIale lhe liading yeais you need lo sliip oul lhe line eIenenl of lhe sliing
and lhen conveil il lo a dale lype. Then you viII le alIe lo peifoin a dale caIcuIalion lo
deleinine lhe diffeience lelveen loday's dale and lhe opening dale.
You can use lhe Sulsli() funclion lo sliip oul lhe line eIenenl of lhe sliing. Hovevei, lhe dale
eIenenl is nol in a conslanl foinal (foi exanpIe, sone days and nonlhs aie expiessed as singIe
digils vhiIe olheis aie lvo digils).
Since lhe dale is aIvays foIIoved ly a space you can use lhe Ios() funclion lo define lhe nunlei
of chaiaclei eIenenls of lhe Sulsli() synlax. You can cieale a vaiialIe caIIed Datc_5ubstrIng
lased on lhis foinuIa:
=SubStr([Opening date] ; 1 ; Pos([Opening date] ;" ")-1)
Then you can cieale anolhei vaiialIe caIIed Open_Dale lo conveil lhe Dale_ Sulsliing vaIues
lo dale lype using lhis foinuIa.
=ToDate([Date_Substring] ; "MM/dd/yy")
Nntc: The dale nusl le foinalled in lhe sane vay as lhe sliing lhal is leing conveiled. Ioi inslance,
if lhe oidei of lhe dales in lhe sliing is Monlh/Day, lhen lhe dale nusl le foinalled lhe sane vay.
If lhe oidei of lhe dales in lhe sliing is Day/Monlh hovevei, lhen lhe foinuIa nusl use lhal foinal
as veII. If you iepIace lhe OpcnIng Datc coIunn in lhe iepoil vilh lhe Opcn_Datc vaiialIe, lhe
coIunn Iooks Iike lhis:
Web ntelligence Advanced Report DesignLearner's Guide 70
Quiz: Character and Date String Functions
1. Nane al Ieasl lhiee chaiaclei sliing funclions used in lhis Iesson.
2. To find lhe occuiience of a conna in an oljecls vaIue, vhich funclion vouId you use`
3. Whal is lhe synlax foi lhe RepIace() funclion`
4. When vouId you choose lo use lhe Lenglh() funclion`
5. Cive an exanpIe of sliing concalenalion.
6. If you vanl lo cieale a foinuIa lo ieluin lhe nunlei of yeais lelveen lvo dales, vhal
vouId lhe synlax le`
7. Can you do caIcuIalions on a dale`
71 Creating Formulas with Character and Date String FunctionsLearner's Guide
Lesson summary
Aflei conpIeling lhis Iesson, you aie nov alIe lo:
- Use chaiaclei sliings
- Use lhe Righl() funclion
- Use lhe RepIace() funclion
- Use lhe SulSli() funclion
- Use lhe Ios() funclion
- Concalenale diffeienl chaiaclei sliings
- Use dale funclions
Web ntelligence Advanced Report DesignLearner's Guide 72
Lesson 5
Using If Logic
Lesson introduction
The If() funclion is a poveifuI looI avaiIalIe lo Wel InleIIigence iepoil designeis. Oflen iefeiied
lo as "If... Then... LIse" Iogic, lhis funclion can le used in nany diffeienl vays lo appIy cuslon
foinuIas in a iepoil.
This Iesson shovs you hov lo use lhe If() funclion Iogic in lvo vays: lo gioup vaIues in a
vaiialIe, and lo nodify lhe vay caIcuIalions lehave vhen ceilain vaIues aie ieluined ly an
oljecl.
Aflei conpIeling lhis Iesson, you viII le alIe lo:
- Use If() lo gioup dala
- Use If() lo nodify caIcuIalion lehavioi
73 Using f LogicLearner's Guide
Using If() to group data
In lhis unil, you viII use lhe If() funclion lo gioup vaIues ieluined fion lhe dalalase inlo
calegoiies. Using lhe If() in lhis nannei, iepoil designeis aie enpoveied lo peifoinlhe iepoil
equivaIenl of lhe Decode, Case, and If funclions avaiIalIe lo univeise designeis al lhe dalalase
IeveI.
If() can le used lo gioup sone of lhe vaIues ieluined ly an oljecl and lhen lo define lhal
giouping as a nev vaiialIe in lhe docunenl.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Cioup vaIues using lhe If() funclion
- Define lhe giouping as a nev vaiialIe in lhe docunenl
Grouping vaIues with the If() function to show higher IeveIs of
detaiI
You can use lhe If() funclion in Wel InleIIigence lo gioup vaIues ieluined ly an oljecl inlo
calegoiies. These calegoiies can lhen le used as lhe lasis foi aggiegaling neasuies al highei
IeveIs of delaiI.
Ioi exanpIe, lhe cFashInn univeise conlains Quartcr and QuantIty sn!d oljecls, vhich aIIov
you lo anaIyze lhe quanlily soIdlolaIs foi each quailei. Hovevei, if youi iepoiling iequiienenl
is lo dispIay lhe quanlily soId neasuie aggiegaled al lhe haIf yeai IeveI of delaiI, lhen lhe
univeise does nol piovide lhe oljecls you need lo neel lhis iequiienenl.
y ciealing a Ha!f Ycar vaiialIe lased on lhe Quartcr oljecl, you can aggiegale quanlily soId
lolaIs foi each haIf of lhe yeai. This dala can lhen le piesenled in lhe sane iepoil vilh quanlily
soId lolaIs foi each quailei.
Web ntelligence Advanced Report DesignLearner's Guide 74
In lhis exanpIe, lhe Ha!f Ycar vaiialIe Iooks al each vaIue foi lhe Quartcr oljecl. If lhe quaileis
ieluined vaIue is eilhei Q1 oi Q2 lhen lhe vaiialIe dispIays lhe voids Yeais Iiisl HaIf and
if lhe quaileis vaIue is anylhing olhei lhan Q1 oi Q2 lhen il dispIays lhe voids Yeais Second
HaIf.
The synlax used vilh lhe If() funclion is:
If (boolean_expr; value_if_true; value_if_false)
boolean_expr iefeis lo an expiession lhal ieluins TRUL oi IALSL.
value_if_true is lhe vaIue ieluined if lhe expiession ieluins TRUL.
value_if_false is lhe vaIue ieluined if lhe expiession ieluins IALSL.
Nntc: In Wel InleIIigence XI 3.x, you can aIso use lhis synlax vilh lhe If() funclion:
If boolean_expr then value_if_true else value_if_false
Using lhis synlax, you iepIace lhe senicoIons in lhe foinuIa vilh lhe voids lhey iepiesenl. Lilhei
synlax pioduces lhe sane iesuIls.
If you vanled lo cieale lhe HaIf Yeai vaiialIe in lhis exanpIe, you couId use lhis synlax:
=If([Quarter] InList("Q1";"Q2"); "Year's First Half"; "Year's Second Half")
Oi lhis synlax:
=If[Quarter] InList("Q1";"Q2") Then "Year's First Half" Else "Year's Second Half"
Nntc: Youcan use lhe InIisl opeialoi lo piovide nuIlipIe vaIues. AII lhe vaIues nusl appeai lelveen
lhe paienlhesis lhal foIIov lhe opeialoi. Lach vaIue nusl le in quoles and sepaialed fion olhei
vaIues ly senicoIon.
LxanpIe :
InList(Q1 ; Q2)
Grouping vaIues with the If() function to show categories
Suppose lhal you need lo dispIay ievenue lolaIs in lolh a lalIe and a 3D pie chail aggiegaled
foi each of lhe eIashion Maikel Types. The lhiee Maikel Types aie Top Ieifoineis, Aveiage
Ieifoineis, and Lov Ieifoineis. Lach sloie needs lo le assigned lo lhe appiopiiale calegoiy
lased on lhe foIIoving lusiness iuIes:
SaIes Revenue Market Type
Ciealei lhan 7,5OO,OOO Top Ieifoineis
elveen 2,OOO,OOO and 7,5OO,OOO Aveiage Ieifoineis
Less lhan 2,OOO,OOO Lov Ieifoineis
75 Using f LogicLearner's Guide
You need lo dispIay ievenue figuies incIuding naikel-lype sullolaIs in lhe lalIe and
naikel-lype ievenue lieakdovns in lhe chail.
You can legin ly ciealing a lalIe using lhe 5tatc and 5a!cs rcvcnuc oljecls.
Nexl, you need lo cieale a Markct Typc dinension vaiialIe, using lhis foinuIa:
=If([Sales revenue]>7500000;"Top Performers" ; If([Sales
revenue]Between(2000000;7500000);"Average Performers"; If([Sales
revenue]<2000000;"Low Performers")))
Oi
=If[Sales revenue]>7500000 Then "Top Performers" ElseIf[Sales
revenue]Between(2000000;7500000) Then "Average Performers" ElseIf[Sales
revenue]<2000000 Then "Low Performers"
If you add a Markct Typc e coIunn lo lhe iepoil, appIy a lieak on Markct Typc, and inseil a
5um on lhe 5a!cs rcvcnuc coIunn, you gel lhis iesuIl:
To inseil lhe chail, diag lhe 3D PIc Dnughnut lenpIale onlo lhe iepoil and inseil lhe 5a!cs
rcvcnuc neasuie on lhe Y-axis and Markct Typc dinension on lhe X-axis Iike lhis:
Web ntelligence Advanced Report DesignLearner's Guide 76
The finished iepoil Iooks Iike lhis:
Activity: Grouping data
Objective
- Use lhe If() funclion synlax lo gioup dala vaIues.
Instructions
You vanl lo gioup slales inlo iegions so lhal you can conpaie ievenue pei iegion.
1. Cieale a nev docunenl using lhe cFashInn univeise and seIecl lhe foIIoving oljecls:
5tatc and 5a!cs rcvcnuc
2. Cieale a vaiialIe caIIed RcgInn and gioup lhe slales ly iegions, lased on lhe foIIoving
calegoiies:
77 Using f LogicLearner's Guide
State Region
CaIifoinia
Wesl
CoIoiado
IIIinois
CenliaI
Texas
Massachusells
Lasl
Nev Yoik
DC
IIoiida
3. Inseil lhe RcgInn vaiialIe inlo lhe lalIe so lhal ils vaIues aie piojecled in a nev coIunn in
lhe lalIe.
Youi iepoil shouId Iook Iike lhis exanpIe:
4. Save lhe docunenl as Act_Groupdata_1.
Activity: Grouping data - OptionaI
Objective
- Use lhe If() funclion synlax lo gioup dala vaIues.
Instructions
You vanl lo gioup sloie nanageis ly lheii degiee of expeiience nanaging lheii sloie. Then,
you aie going lo cieale a iepoil lhal shovs lhe saIes ievenue eained ly each nanagei in each
lenuie-lype calegoiy.
Web ntelligence Advanced Report DesignLearner's Guide 78
Il is necessaiy lo cieale a vaiialIe lo gioup lhe nanageis inlo calegoiies, lecause expeiience,
oi lenuie lype, is nol an oljecl lhal is avaiIalIe in lhe eIashion univeise.
1. Cieale a nev Wel InleIIigence docunenl using lhe cFashInn univeise.
2. IncIude lhe Namc nf managcr, 5tatc, and 5a!cs rcvcnuc oljecls in lhe queiy.
3. Cieale a vaiialIe caIIed Tcnurc typc.
4. VaIidale lhe synlax andveiify lhal Wel InleIIigence has appIiedlhe DImcnsInnquaIificalion
lo lhe vaiialIe.
5. Define lhe foinuIa lo gioup each sloie nanagei inlo a calegoiy, lased on lhe foIIoving
lenuie-lype calegoiies:
Name of manager Tenure type
ennell Tiainee
Leonaid
}unioi TullIe
Queen
Andeison
Senioi
aiiell
Laiiy
Maik
MicheIIe
Quinn
Richaids
Sleve
6. Inseil lhe Tcnurc typc vaiialIe inlo lhe lalIe so lhal ils vaIues aie piojecled in lhe fiisl
coIunn in lhe lalIe.
7. Ioinal lhe iepoil so lhal il is oiganized in lIocks lhal shov lhe saIes ievenue eained ly
lhe nanageis in each lenuie-lype calegoiy.
79 Using f LogicLearner's Guide
Youi iepoil shouId Iook Iike lhis:
8. Save lhe docunenl as Act_Groupdata_2.
Activity: Grouping data - OptionaI 2
Objective
- Use lhe If() funclion synlax lo gioup dala vaIues.
Instructions
You vanl lo divide pioducls inlo gioups lased on UnIt PrIcc M5RP ianges lo see if lheie is a
ieIalionship lelveen piice iange and QuantIty 5n!d.
1. Cieale a nev Wel InleIIigence docunenl using lhe cFashInn univeise.
2. IncIude lhe 5KU Dcsc, UnIt PrIcc M5RP, and QuantIty 5n!d oljecls in lhe queiy.
3. Cieale a vaiialIe caIIed PrIcc Rangc, using lhese calegoiies:
Price range Group
Ovei $3OO High Iiice
Web ntelligence Advanced Report DesignLearner's Guide 80
Price range Group
elveen $15O and $3OO Mid Iiice
eIov $15O Lov Iiice
4. Inseil a PrIcc Rangc coIunn in lhe lalIe.
5. AppIy a lieak on PrIcc Rangc, and soil lhe PrIcc Rangc coIunn lo dispIay lhe iepoil lIocks
in lhis oidei:
High Iiice, Mid Iiice, Lov Iiice
6. AppIy an Avcragc caIcuIalion on lhe QuantIty 5n!d coIunn.
The fiisl lIock in youi iepoil shouId Iook siniIai lo lhis:
81 Using f LogicLearner's Guide
Using the If() function to modify caIcuIation behavior
The If() funclion is usefuI foi exlending lhe funclionaIily andfIexiliIily of caIcuIalions in iepoils.
Moie specificaIIy, ly using lhe If() funclion, iepoil designeis can change hova neasuie lehaves
lased on each vaIue ieluined foi an oljecl.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Use lhe If() funclion lo nodify hovdala is caIcuIaled depending on lhe vaIues ieluined ly
an oljecl used in lhe iepoil
Modifying the way caIcuIations behave
You can aIso use lhe If() funclion lo exlend lhe funclionaIily of caIcuIalions so lhal lhey lehave
noie dynanicaIIy.
The synlax foi using lhe If() funclion lo nodify lhe lehavioi of caIcuIalions is:
=If([object name]= true value; [measure] behavior A ; [measure] behavior B)
Oi
=If[object name]= true value Then [measure] behavior A Else [measure] behavior
B
In olhei voids: if lhe vaIue ieluined ly an oljecl is equaI lo vhal is specified in quoles, lhen
lhe caIcuIalion shouId lehave in a ceilain nannei, olheivise, lhe vaIue shouId le caIcuIaled
in a diffeienl nannei.
Suppose lhal you vanl lo luiId a iepoil lhal caIcuIales lhe laigel ievenue foi each sloie. You
legin ly ciealing a queiy incIuding lhe 5tatc, 5tnrc namc, and 5a!cs rcvcnuc oljecls, iesuIling
in lhis lalIe.
Nov you need lo inseil a coIunn lhal shovs lhe appiopiiale laigel ievenue foi each sloie.
Lach sloie has a diffeienl laigel foi lhe peicenlage of giovlh lo achieve lased on lhe slale in
vhich lhe sloie is Iocaled. Theiefoie, a singIe caIcuIalion viII nol voik.
Web ntelligence Advanced Report DesignLearner's Guide 82
The sloies in lhe foIIoving slales aie lo giov lheii ievenue lased on lhese peicenlages:
% Growth Required State
5 CaIifoinia
1O CoIoiado
15 DC
15 IIoiida
15 IIIinois
18 Massachusells
15 Nev Yoik
15 Texas
You can cieale a Targct Rcvcnuc Bascd nn RcquIrcd % Grnwth vaiialIe using lhis synlax:
=If([State]="California" ; [Sales revenue]*1.05 ; If([State]="Colorado" ; [Sales
revenue]*1.1 ; If([State]InList ("DC";"Florida";"Illinois";"New York";"Texas ")
; [Sales revenue]*1.15 ; If([State]="Massachusetts" ; [Sales revenue]*1.18))))
Oi, if you piefei lo cieale lhe foinuIa using lexl ialhei lhan senicoIons:
=If[State]="California" Then [Sales revenue]*1.05 ElseIf [State]="Colorado" Then
[Sales revenue]*1.1 ElseIf [State] InList ("DC" ; "Florida" ; "Illinois" ; "New
York" ; "Texas ") Then [Sales revenue]*1.15 ElseIf [State]="Massachusetts" Then
[Sales revenue]*1.18
If you add lhis vaiialIe lo lhe iepoil, and appIy lhe appiopiiale foinalling lo lhe coIunn, you
gel lhis iesuIl:
83 Using f LogicLearner's Guide
Syntax of the If() function
This synlax is lased on lhe If.Then.LIse Iogic and lhe peicenlage iales lhal each slale is
supposed lo giov ly.
Sone consideialions iegaiding lhis synlax aie:
- When you Iisl a singIe slale, you pIace lhe "=" sign lefoie lhe Slale vaIue, lul vhen lvo (oi
noie) slales aie Iisled, you use lhe InLisl opeialoi.
- The synlax iequiies lhal vhen nuIlipIe vaIues (Slales) aie Iisled, aII lhe vaIues nusl appeai
in paienlheses and each individuaI vaIue nusl le in quoles as veII as sepaialed fion lhe
olhei vaIues ly a senicoIon.
Activity: Modifying the caIcuIation behavior
Objective
- Use lhe If() funclion lo cieale a vaiialIe lhal caIcuIales lhe piojecled ievenue lased on
ievenue ly sloie.
Instructions
Using lhe cFashInn univeise, you vanl lo dispIay lhe piojecled ievenue foi each sloie lased
on lhe ievenue geneialed lo dale. You need lo cieale a vaiialIe lo caIcuIale lhis piojeclion
lased on lhe saIes ievenue.
This vaiialIe needs lo Iook al lhe saIes ievenue, and if il faIIs alove ceilain ciileiia, lhen a
diffeienl caIcuIalion needs lo le peifoined.
1. Cieale a nev Wel InleIIigence docunenl using lhe cFashInn univeise.
2. IncIude lhe 5tatc, 5tnrc namc and 5a!cs rcvcnuc oljecls in lhe queiy.
Web ntelligence Advanced Report DesignLearner's Guide 84
3. Cieale a vaiialIe caIIed Prnjcctcd Rcvcnuc.
4. Define lhe foinuIa lo caIcuIale each sloies piojecled ievenue lased on lhe foIIoving:
Amount Revenue
1.25 >=2OOOOOO
1.15 >=15OOOOO
1.O5 AII olheis
5. VaIidale lhe synlax and veiify lhal Wel InleIIigence has appIied lhe Mcasurc quaIificalion
lo lhe vaiialIe.
6. Diag lhe Prnjcctcd VarIab!c vaiialIe lo lhe iighl of lhe Iasl coIunn in lhe lalIe.
Youi iepoil appeais Iike lhis exanpIe:
85 Using f LogicLearner's Guide
Quiz: Using If Logic
1. Whal is anolhei lein foi lhe Iogic used ly lhe If() funclion`
2. Which of lhe foIIoving aie exanpIes of vhy you nighl use lhe If() funclion lo gioup vaIues
in a vaiialIe:
- To dispIay calegoiies of vaIues
- To shov vaIues aggiegaled al highei IeveIs of delaiI
3. Tiue/IaIse. You can use lhe If() funclion lo define a vaiialIe so lhal a diffeienl caIcuIalion
is used depending on lhe vaIue ieliieved ly lhe oljecl specified in lhe vaiialIes foinuIa.
Web ntelligence Advanced Report DesignLearner's Guide 86
Lesson summary
Aflei conpIeling lhis Iesson, you aie nov alIe lo:
- Use If() lo gioup dala
- Use If() lo nodify caIcuIalion lehavioi
87 Using f LogicLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide 88
Lesson 6
Working with AdditionaI Reporting Techniques
Lesson introduction
In lhis Iesson you viII expIoie seveiaI iepoiling lechniques, incIuding using dala liacking lo
quickIy idenlify changes in iepoil dala, deleinining vhelhei a chaiaclei sliing nalches a
pailicuIai pallein, oveiiding iepoil fiIleis oi ianking lo caIcuIale lolaI vaIues, dispIaying a
iunning sun, and dispIaying diiII fiIleis.
Aflei conpIeling lhis Iesson, you viII le alIe lo:
- Use dala liacking
- Use addilionaI iepoil funclions
89 Working with Additional Reporting TechniquesLearner's Guide
Using data tracking
Wilh Wel InleIIigence dala liacking, you can quickIy idenlify lhe dala changes and focus on
lhe nosl ieIevanl dala vhen you anaIyze lhe changes.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Undeisland addilionaI aspecls of dala liacking
- Use foinuIa Ianguage lo dispIay and peifoin caIcuIalions on lhe iefeience dala sel
Understanding data tracking
Wilh dala liacking you can highIighl lhe vaIues lhal have changed since a pievious iefiesh foi
any IeveI of aggiegalion.
Adocunenl vilh dala liacking aclivaled ieliieves lvo niciocules -- one foi lhe iefeience dala
sel and one foi lhe cuiienl dala sel. The docunenl conpaies lhe dala in lhe lvo niciocules
and highIighls lhe changes accoiding lo lhe foinalling lhal you defined foi lhe changes.
SiniIaiIy, vhen a docunenl conlains caIcuIalions on lhe dala sel, il conpaies lhe caIcuIalions
on each dala sel lo dispIay lhe changes.
A docunenl vilh dala liacking aclivaled conlains lvo lines noie dala lhan a docunenl foi
vhich dala liacking is nol aclive so lhe dala liacking docunenl can lake up lo lhiee lines
Iongei lo iefiesh.
Ceilain aclions cIeai lhe docunenl of lhe dala sloied in lhe niciocules oi nodify lhe dala
piovidei. When lhe docunenl no Iongei conlains lhe dala, lhe dala liacking funclion cannol
conpaie lhe dala sels and highIighl lhe changes. SiniIaiIy, vhen lhe dala piovidei changes,
lhe cuiienl veision of lhe docunenl is nol conpalilIe vilh lhe iefeience veision so lhe changed
dala does nol dispIay.
The aclions lhal cIeai lhe docunenl of lhe dala oi change lhe dala piovidei incIude:
- DiiIIing oul of scope.
- Using lhe queiy diiII.
- DeIeling a queiy.
- Modifying lhe SQL geneialed ly a dala piovidei. This incIudes nodifying secuiily iighls.
- Iuiging lhe docunenl.
Nntc: When you uninlenlionaIIy puige a docunenl, you can iecupeiale lhe dala fion lhe
niciocule lefoie you save lhe puiged docunenl. CIose lhe docunenl, do nol save il, and
open il again.
Using formuIa Ianguage to track data changes
You can use lhe foinuIa Ianguage lo incIude caIcuIalions lased on dala changes. Ioi exanpIe,
you can incIude a caIcuIalion lo shovlhe diffeience lelveen lhe pievious vaIue and lhe cuiienl
vaIue of a neasuie. You can aIso use foinuIa Ianguage lo luiId cuslonaIeileis foi foinalling
dala changes.
Web ntelligence Advanced Report DesignLearner's Guide 90
To dispIay lhe iefeience dala sel in youi iepoil, you can use lhe RefValue funclion lo cieale a
foinuIa oi vaiialIe. This funclion gives lhe vaIue of lhe iefeience dala foi lhe neasuie. When
lheie is no iefeience dala, lhe funclion ieluins nuII.
Ioi exanpIe, vhen lhe Rcvcnuc neasuie cuiienlIy has lhe vaIue 1OOO, and lhe iefeience vaIue
is 9OO, lhe foinuIa RefValue([Revenue]) ieluins 9OO.
The RcfVa!ucDatc funclion ieluins lhe dale of lhe iefeience dala used foi dala liacking.
Security for data tracking
Tvo secuiily oplions exisl foi lhe dala liacking fealuie. Youi syslenadninislialoi deleinines
lhe iighls assigned lo each usei. Hovevei, vhen you voik vilh diffeienl iepoil useis, you
nay vanl lo knov lhe diffeienl piofiIes lhal exisl:
- The iighl lo see, lul nol nodify lhe dala liacking.
- The iighl lo see dala liacking, and lo use lhe inleiface eIenenls foi dala.
Activity: CaIcuIating on changed data
Objectives
- In lhis aclivily, you use lhe rcfVa!uc and rcfVa!uc datc funclions lo dispIay lhe iefeience
dala in youi iepoil.
- Nntc: Ioi lhis aclivily, you cieale a iepoil on lhe IocaI dala souice Data Tracking1.xls
and aclivale dala liacking. Then, lo sinuIale a change in lhe dala, you iun lhe iepoil againsl
Data Tracking2.xls vhichhas updaleddala. Youcanfindlhese Miciosofl LxceI spieadsheel
fiIes in lhe couise iesouices. You nay vanl lo cieale a lackup of lolh fiIes lefoie leginning
lhe aclivily.
Instructions
1. Cieale a nev docunenl fion lhe IocaI dala souice Data Tracking1.xls.
Nntc: You can find lhe Data Tracking1.xls fiIe in lhe couise iesouices.
91 Working with Additional Reporting TechniquesLearner's Guide
2. Ioinal lhe iepoil lo Iook Iike lhe one leIov:
3. Aclivale dala liacking lo use lhe cuiienl dala sel as lhe iefeience dala sel foi aII iefieshes.
4. Define lhe foinalling foi dala changes.
5. Make lhe foIIoving changes:
- Cieale a coIunn lo lhe iighl of lhe 5a!cs rcvcnuc coIunn foi lhe saIes ievenue in lhe
iefeience dala sel and dispIay lhe vaIues.
- DispIay lhe iefeience dala sel dale al lhe lop of lhe iepoil.
- DispIay a sun foi lhe 5a!cs rcvcnuc coIunn.
- In lhe ceII nexl lo lhe lolaI 5a!cs rcvcnuc sun, pIace a vaiialIe lo caIcuIale lhe diffeience
lelveen lhe cuiienl saIes ievenue and lhe ievenue fion lhe iefeience dala sel.
Web ntelligence Advanced Report DesignLearner's Guide 92
The iepoil appeais Iike lhis:
6. Using Windovs LxpIoiei, liovse lo lhe Iocalion of lhe Data Tracking 1.xls and Data
Tracking2.xls Miciosofl LxceI fiIes in youi couise iesouices foIdei.
7. Renane Data Tracking 2.xls lo Data Tracking 1.xls.
8. In Wel InleIIigence, iefiesh lhe dala in lhe iepoil.
The iepoil appeais Iike lhis:
93 Working with Additional Reporting TechniquesLearner's Guide
Using additionaI report functions
This unil desciiles seveiaI funclions lhal youcan use lo dispIay specific dala in youi docunenls.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Use lhe Malch() funclion lo deleinine vhelhei a chaiaclei sliing nalches a pailicuIai pallein
- Use lhe NoIiIlei() funclion lo oveiiide a iepoil fiIlei oi ianking
- Use lhe RunningSun() funclion lo ieluin lhe iunning sun of a sel of nunleis
- Use lhe DiiIIIiIlei() funclion lo ieluin lhe diiII fiIleis appIied lo a docunenl oi used in diiII
node oi use lhe DrI!! FI!tcrs ceII fion lhe Tcmp!atcs lal.
- UndeislandaddilionaI funclions lhal enhance lhe foinuIa Ianguage in lhe Wel InleIIigence
XI 3.O/3.1 ieIease.
Determining matches in strings
The Malch() funclion aIIovs you lo deleinine vhelhei a chaiaclei sliing nalches a pailicuIai
pallein.
The Malch() funclion is a looIean funclion and ieluins 1 if lheie is a nalch oi O if lheie is no
nalch.
Synlax:
boolean Match(string input_string; string pattern)
input_string defines lhe sliing lo le seaiched foi.
pattern is lhe chaiaclei sliing you vish lo seaich foi.
The viIdcaids lhal you can use vilh lhis funclion incIude:
- * (asleiisk) foi any nunlei of chaiacleis.
- ` (queslion naik) foi any one chaiaclei.
Suppose lhal you vanl lo cieale a iepoil lhal idenlifies eIashion Iocalions vilh lhe lianding
"Sundance" oi "MagnoIia" in lheii sloie nane. You can cieale a Sloie Type vaiialIe using lhis
synlax:
=If(Match([Store name] ; "*Sundance") ; "Sundance" ; If(Match([Store name] ;
"*Magnolia") ; "Magnolia" ; "Un- Branded"))
Oi
=If Match([Store name] ; "*Sundance") Then "Sundance" ElseIf Match([Store name]
; "*Magnolia") Then "Magnolia" Else "Un- Branded"
Overriding a report fiIter or ranking
Al lines you nay need lo dispIay a caIcuIalion lhal incIudes lolh lhe dala lhal is shovn in lhe
lalIe and dala lhal is piesenl in lhe dala piovidei, lul nol cuiienlIy shovn in lhe lalIe. The
onIy vay lo achieve lhis is lo foice Wel InleIIigence lo ignoie a iepoil fiIlei oi ianking lhal has
leen appIied lo an oljecl oi vaiialIe in lhe dala piovidei.
Web ntelligence Advanced Report DesignLearner's Guide 94
Use lhe NoIiIlei() funclion lo oveiiide a iepoil fiIlei oi ianking. NoIiIlei() incIudes aII of lhe
vaIues foi a vaiialIe in lhe dala piovidei in lhe caIcuIalion, even if lhe dala is nol dispIayed in
lhe lalIe oi lIock.
Synlax:
expression_output_type NoFilter(expression)
Suppose lhal you have a iepoil lhal uses ianking lo dispIay lhe lop lhiee sloies pei yeai.
ecause lhis iepoil uses ianking, lhe sunfoi lhe SaIes ievenue coIunn onIy incIudes lhe iesuIls
fionlhe lhiee lop-peifoining sloies. If you vouId Iike lo add a iovlo lhe iepoil lhal dispIays
lhe lolaI SaIes ievenue foi aII lhe iesl of lhe eIashion sloies, you can appIy anolhei Sun lo lhe
SaIes ievenue coIunn, and edil lhe inseilion foinuIa Iike lhis:
=NoFilter(Sum([Sales revenue]))-Sum([Sales revenue])
y dissecling lhis foinuIa, you can see hov lhe foinuIa ieluins lhe desiied iesuIl.
Syntax and description: FormuIa component:
NoFilter(Aggregate([Measure]))
This ieluins lhe sun of aII lhe sloies and
ignoies iank.
=NoFilter(Sum([Sales revenue]))
This pail of lhe foinuIa ieluins lhe sun of
lhe sloies in lhe cuiienl lIock (vilh lhe iank).
-Sum([Sales revenue])
Il does nol incIude lhe sloies lhal have leen
excIuded.
To add anolhei Iine lo lhe iepoil, dispIaying lhe lolaI ievenue foi aII Iocalions, you can appIy
anolhei sun lo lhe SaIes ievenue coIunn, and nodify lhe inseilion foinuIa Iike lhis:
95 Working with Additional Reporting TechniquesLearner's Guide
=NoFilter(Sum([Sales revenue]))
If you add sone lexl IaleIs lo desciile lhe nev iovs of lhe lalIe, lhe iepoil Iooks Iike lhis:
DispIaying a running sum
The RunningSun() funclion is one of a nunlei of iunning aggiegale funclions avaiIalIe foi
caIcuIaling dala in Wel InleIIigence. Olheis incIude RunningAveiage(), RunningCounl(),
RunningMin(), and RunningMax().
A iunning sun is a lolaI lhal is accunuIaled fion vaIue lo vaIue acioss a seiies of vaIues.
You can aIso use iunning aggiegale funclions.
Use lhe RunningSun() funclion lo ieluin lhe iunning sun of a sel of nunleis. One lenefil of
lhe iunning aggiegale funclions is lhal a iesel can le appIied lo lhen vilhin lhe iepoil. This
aIIovs you lo slail lhe cunuIalive lolaI ovei al a given vaIue, such as al a lieak.
Synlax:
number
RunningSum([measure];[Row|Col];[(reset_dimensions)])
[any measure] iefeis lo any neasuie oljecl in lhe dala piovidei.
Row|Col iefeis lo lhe caIcuIalion diieclion (oplionaI paianelei).
reset_dimensions iefeis lo lhe Iisl of dinensions used lo iesel lhe iunning sun (oplionaI).
Web ntelligence Advanced Report DesignLearner's Guide 96
Suppose lhal you aie ciealing a iepoil lo shov Yeai, Sloie nane, and SaIes ievenue, giouped
ly Slale. You vouId Iike lo add anolhei coIunn lo lhe iepoil lo dispIay a iunning sun. You
can cieale a Running TolaI vaiialIe using lhis foinuIa:
=RunningSum([Sales revenue])
If you add a Running TolaI coIunn lo lhe iepoil, il Iooks Iike lhis:
If you vouId Iike lhe iunning lolaI lo iesel foi each slale, you can nodify lhe foinuIa lo iesel
lhe lolaI each line lhe lalIe lieaks:
=RunningSum([Sales revenue] ; ([State]))
Nov lhe iepoil Iooks Iike lhis:
97 Working with Additional Reporting TechniquesLearner's Guide
DispIaying driII fiIters in the report
As you diiII dovn and up hieiaichies in a docunenl in diiII node, you nay vanl lo dispIay
lhe diiII fiIleis lhal you aie using al any given nonenl. You can lhen save lhe docunenl as a
IDI oi piinl il, and olhei useis can see lhe diiII fiIleis you veie using as you diiIIed.
Use lhe DrI!! FI!tcrs ceII, lased on lhe DiiIIIiIleis() funclion lo ieluin lhe diiII fiIleis appIied
lo a docunenl oi lo an oljecl using diiII node. This is usefuI if you vanl lo piinl a diiIIed
docunenl and shov lhe diiII fiIleis aIong vilh lhe iepoil ilseIf.
Nntc: The DrI!! FI!tcrs ceII and lhe DiiIIIiIleis() funclion onIy ieluin dala vhen you viev lhe
docunenl vilh diiII node aclive.
Synlax:
string DrillFilters([object]; [string separator])
[object] iefeis lo any oljecl in lhe dala piovidei.
string separator iefeis lo lhe diiII fiIlei sepaialoi (oplionaI paianelei).
LxanpIes:
Ioi a docunenl in diiII node:
Web ntelligence Advanced Report DesignLearner's Guide 98
Returns: Syntax:
"CoIoiado - CoIoiado Spiings" if lhe docunenl has leen diiIIed
inlo lhe slale of CoIoiado and inlo lhe cily of CoIoiado Spiings
=DiiIIIiIleis()
When you cieale a iepoil lo dispIay Slale and SaIes ievenue, and vanl lo dispIay lhe diiII fiIleis
lhal aie appIied vhen lhe iepoil is vieved in DiiII node, you can use lhe DrI!! FI!tcrs ceII lo
dispIay lhe diiII fiIleis in a singIe ceII. AIleinaliveIy, you can cieale a DiiII IiIlei vaiialIe using
lhis foinuIa lo dispIay lhe diiII fiIleis in a coIunn:
=DrillFilters()
The DrI!! FI!tcrs ceII oi lhe DiiII IiIlei coIunn dispIay dala onIy vhen you aclivale diiII node
and legin lo diiII in lhe iepoil. If you diiII dovn lhe Slale dinension lo lhe Sloie nane IeveI,
a iepoil vilh lhe DrI!! FI!tcrs ceII Iooks Iike lhis:
Nntc: You can change lhe chaiaclei used lo sepaiale lhe fiIlei IeveIs ly nodifying lhe vaiialIe
foinuIa. Ioi exanpIe:
Returns Syntax:
CoIoiado / CoIoiado Spiings
=DiiIIIiIleis("/")
Understanding additionaI functions
You can use addilionaI funclions nol piesenled in delaiI in lhis Iesson. Sone exanpIes appeai
leIov.
5yntax and Examp!cs: Rcturns: FunctInn:
number Product([measure]) The pioducl of a sel of
nuneiicaI vaIues.
Iioducl()
=Iioducl(|Measuiej):
Reluins 3O if |Measuiej has lhe vaIues 2, 3, 5 .
99 Working with Additional Reporting TechniquesLearner's Guide
5yntax and Examp!cs: Rcturns: FunctInn:
expression_output_type Mode(expression) The nosl
fiequenlIy-occuiiing
vaIue in a sel of vaIues.
Mode()
Mode(|Revenuej):
Reluins 2OO if |Revenuej has lhe vaIues 1OO, 2OO,
3OO, 2OO.
Mode(|Counliyj):
Reluins lhe nosl fiequenlIy-occuiiing vaIue of
|Counliyj.
Nntc: Mode ieluins nuII if lhe sel of vaIues does nol
conlain one vaIue lhal occuis noie fiequenlIy lhan aII
lhe olheis.
string DataProviderType (object
data_provider)
The lype of dala
piovidei.
DalaIiovideiType()
DalaIiovideiType(|SaIesj):
Reluins "Univeise" if lhe SaIes dala piovidei is
lased on a univeise.
Nntc: LncIose lhe nane of lhe dala piovidei in squaie
liackels.
Activity: DispIaying data restricted by a fiIter or ranking
Objective
- uiId a foinuIa lo oveiiide a ianking and caIcuIale lolaI vaIues.
Instructions - ExampIe 1
Cieale a docunenl lhal dispIays lhe lesl saIes ievenue achieved foi any yeai ly slale. Ioi
puiposes of conpaiison, you aIso vanl lo dispIay lhe lolaI slale ievenue.
To achieve lhis, you need lo cieale a nev vaiialIe using lhe NnFI!tcr() funclion. You viII aIso
appIy lieaks, ianking and foinalling lo lhe lalIe.
1. Use lhe cFashInn univeise lo luiId a queiy vilh lhe appiopiiale oljecls.
Web ntelligence Advanced Report DesignLearner's Guide 100
2. Modify lhe docunenl lo dispIay lhe dala as shovn in lhe foIIoving scieen capluie:
Nntc: To dispIay lhe dala as shovn, appIy a lieak lo lhe lalIe and foinal lhe lieak so lhe
lieak headei and foolei do nol dispIay.
3. DispIay a lalIe headei.
4. On lhe Yeai coIunn, dispIay onIy lhe highesl eaining yeai foi each slale.
5. Cieale a nev vaiialIe caIIed Tnta! rcvcnuc using lhe foIIoving synlax:
=NoFilter([Sales revenue] In([State]))
Nntc: y pulling In([State]) al lhe end of lhe foinuIa, you change lhe vay Wel
InleIIigence caIcuIales dala ly defauIl. This is knovn as changing lhe caIcuIalion conlexl.
6. Add lhe nevvaiialIe lo lhe lalIe and dispIay lhe sunin lhe foolei of lolh lhe 5a!cs rcvcnuc
and lhe nev Tnta! rcvcnuc coIunns.
7. Veiify lhe caIcuIalion dispIayed leIov lhe Tnta! rcvcnuc coIunn. Has lhe sun caIcuIaled
lhe dala coiieclIy`
8. Using lhe Fnrmu!a looIlai, nodify lhe foinuIa used in lhe Tnta! Rcvcnuc foolei ceII lo
caIcuIale lhe sun lolaI accuialeIy.
The finaI iepoil appeais Iike lhis:
101 Working with Additional Reporting TechniquesLearner's Guide
9. Save lhe docunenl as Act_NoFilter.
Instructions - ExampIe 2
1. In lhe sane docunenl, luiId a nev queiy lo shov lhe slale, sloie nane, yeai, and quanlily
soId vilh a queiy fiIlei lhal pionpls lhe iepoil useis lo specify lhe slale(s) lhal lhey vanl
lo see.
2. Run lhe nev queiy and choose Ca!IfnrnIa and Cn!nradn vhen pionpled.
3. AppIy a lieak lo oiganize lhe dala ly slale.
4. DispIay lhe QuantIty 5n!d lolaIs pei slale in lhe lieak fooleis.
5. Shov onIy lhe yeai lhal soId lhe highesl quanlilies.
6. Inseil a nev foolei iov and luiId a foinuIa lo shov lhe sun of lhe quanlilies soId in lhe
olhei lvo yeais.
7. Lnlei lexl lo idenlify lhe vaIues dispIayed in lhe lieak fooleis.
8. In lhe lalIe foolei, luiId a foinuIa lo shovlhe lolaI sunof lhe quanlilies soId ly aII sloies.
9. Lnlei lexl lo idenlify lhe vaIue dispIayed in lhe lalIe foolei.
The iepoil appeais Iike lhis:
Web ntelligence Advanced Report DesignLearner's Guide 102
1O. Save lhe docunenl.
103 Working with Additional Reporting TechniquesLearner's Guide
Quiz: AdditionaI Reporting Techniques
1. When you appIy a slandaid caIcuIalion such as a Sunoi an Aveiage on a coIunn in a lalIe
vilh a lieak, vheie is lhe caIcuIalion inseiled`
- In a dala ceII
- In lhe lieak foolei
- In lhe seclion
- In lhe lieak headei
2. Hov do you foinal a lieak`
3. Which funclion can you use lo deleinine vhelhei a chaiaclei sliing nalches a pailicuIai
pallein`
4. Whal is lhe synlax foi ciealing a iunning sun on Maigin vilh a iesel on Yeai`
5. Which funclion vouId you use if you vanl lo shov lhe SQL foi a pailicuIai queiy`
6. Which funclion can you use lo oveiiide a iepoil fiIlei oi a ianking`
7. Hov can you dispIay a iepoil fiIlei`
Web ntelligence Advanced Report DesignLearner's Guide 104
Lesson summary
Aflei conpIeling lhis Iesson, you aie nov alIe lo:
- Use dala liacking
- Use addilionaI iepoil funclions
105 Working with Additional Reporting TechniquesLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide 106
Lesson 7
Creating HyperIinks
Lesson introduction
You can cieale hypeiIinks fion youi docunenls lo URLs and lo olhei docunenls in Wel
InleIIigence XI 3.O/3.1.
Aflei conpIeling lhis Iesson, you viII le alIe lo:
- Woik vilh hypeiIinks in Wel InleIIigence docunenls
- Cieale hypeiIinks in lhe Inleiaclive paneI
- Cieale hypeiIinks in Wel InleIIigence Rich CIienl and lhe }ava Repoil IaneI
107 Creating HyperlinksLearner's Guide
Working with hyperIinks in Web InteIIigence documents
In Wel InleIIigence XI 3.O/3.1, you can cieale hypeiIinks lo docunenls and lo URLs.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Undeisland lhe diffeienl oplions foi ciealing hypeiIinks in Wel InleIIigence
- Knov lhe oplions avaiIalIe lo you in lhe paneI lhal you use
About hyperIinks in Web InteIIigence
In youi Wel InleIIigence docunenls, you can cieale hypeiIinks lo:
- Olhei docunenls such as Wel InleIIigence docunenls oi CiyslaI Repoils
Ioi exanpIe, a docunenl lhal shovs saIes iesuIls pei sloie can dispIay lhe sloie nane as a
hypeiIink lo anolhei docunenl vilh sloie delaiIs. The delaiIs can incIude lhe sloie fIooi
aiea, Iocalion, nunlei of enpIoyees and opening houis.
- URLs oi velsiles
Ioi exanpIe, lhe docunenl lhal shovs sloie delaiIs can dispIay a hypeiIink lo a velsile
lhal shovs lhe pionolionaI offeis and neichandise avaiIalIe al lhe sloie foi lhe cuiienl
peiiod. The velsile aIso gives access infoinalion and opening houis foi lhe sloie.
In lhe Wel InleIIigence IntcractIvc paneI, you can cieale aII hypeiIinks via a diaIog lox.
In lhe Wcb Intc!!Igcncc RIch C!Icnt nain vindov and lhe Java Rcpnrt Panc!, you can cieale
hypeiIinks lo:
- URLs oi velsiles via a diaIog lox.
- Olhei docunenls via lhe OpenDocunenl connand.
The appendix lo lhis couise, Ciealing HypeiIinks vilh lhe OpenDocunenl Connand,
coveis ciealing hypeiIinks vilh lhe OpenDocunenl connand.
Web ntelligence Advanced Report DesignLearner's Guide 108
Creating hyperIinks in the Web InteIIigence Interactive
paneI
You can cieale aII hypeiIinks via a singIe diaIog lox in lhe Wel InleIIigence IntcractIvc paneI.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Cieale hypeiIinks lo URLs and velsiles in lhe IntcractIvc paneI
- Cieale hypeiIinks lo olhei docunenls
About hyperIinks in the Interactive paneI
When you use IntcractIvc vieving node lo viev a Wel InleIIigence docunenl in InfoViev,
you can cieale a hypeiIink vilh lhe Crcatc Hypcr!Ink diaIog lox. The diaIog lox changes
dynanicaIIy lo dispIay lhe oplions lhal you can associale vilh youi hypeiIink.
When you cIick lhe LInk tn dncumcnt oplion, lhe diaIog lox dispIays a fieId foi lhe palh lo
lhe docunenl and a Brnwsc lullon lo heIp you liovse lo lhe docunenl.
109 Creating HyperlinksLearner's Guide
When you cIick lhe Brnwsc lullon, lhe Chnnsc a dncumcnt diaIog lox dispIays. You can
liovse lo youi docunenl oi peifoin a seaich foi il fion lhe diaIog lox.
When you seIecl lhe docunenl, lhe fieIds foi defining lhe oplions associaled vilh lhe hypeiIink
dispIay.
Web ntelligence Advanced Report DesignLearner's Guide 110
You can choose lo:
- Refiesh lhe docunenl vhen you cIick lhe hypeiIink.
- Link lo a specific docunenl inslance.
- Link lo a specific aiea in lhe docunenl.
- Iass a pionpl vaIue lo lhe docunenl.
- Cuslonize lhe Iook and lehavioi of lhe hypeiIink. Ioi exanpIe, you can have lhe hypeiIink
dispIay lhe docunenl in a nev vindov oi dispIay a looIlip lhal desciiles lhe docunenl
vhen you nove lhe nouse ovei lhe hypeiIink.
When you cIick lhe LInk tn wcbpagc oplion, lhe diaIog lox dispIays a fieId foi lhe URL.
111 Creating HyperlinksLearner's Guide
When you enlei lhe URLandcIick lhe Parsc lullon lhe fieIds foi defining lhe oplions associaled
vilh lhe hypeiIink dispIay.
To create a hyperIink in the Interactive paneI
1. Log onlo InfoViev and dispIay lhe InfoViev Prcfcrcnccs page.
Nntc: Log onlo InfoViev using lhe usei nane and passvoid piovided lo you ly lhe cIass
insliucloi.
2. In lhe Wcb Intc!!Igcncc Prcfcrcnccs zone, veiify lhal lhe Dcfau!t vIcwfnrmat oplion is sel
lo IntcractIvc.
3. Open oi cieale a nev Wel InleIIigence docunenl in InfoViev, lhen, iighl-cIick lhe ceII oi
ceIIs conlaining lhe lexl lhal you vanl lo nake a hypeiIink and in lhe conlexl nenu, cIick
Hypcr!Ink > Ncw.
The Crcatc Hypcr!Ink diaIog lox dispIays.
4. Depending on vhelhei you vanl lo Iink lo a URL oi a docunenl, cIick lhe:
- LInk tn wcb pagc lullon lo Iink lo a vel page oi URL and in lhe Entcr thc URL bc!nw...
fieId, lype lhe URL. Iioceed lo slep 5.
- LInk tn dncumcnt lullon and cIick lhe Brnwsc lullon lo liovse lo and seIecl youi
docunenl. Iioceed lo slep 6.
Web ntelligence Advanced Report DesignLearner's Guide 112
5. CIick lhe Parsc lullon.
6. Define lhe oplions associaled vilh youi hypeiIink and cIick OK.
The vaIue(s) lhal you seIecled in youi docunenl nov appeai as (an) aclive hypeiIink(s).
113 Creating HyperlinksLearner's Guide
Creating hyperIinks in Web InteIIigence Rich CIient and
the Java Report PaneI
In lhe Wcb Intc!!Igcncc RIch C!Icnt nain vindov and lhe Java Rcpnrt Panc!, you use lhe
Hypcr!Inks diaIog lox lo cieale a hypeiIink lo a URL.
Aflei conpIeling lhis unil, you viII le alIe lo:
- Cieale a hypeiIink lo a URL vilh lhe Hypcr!Inks diaIog lox
About hyperIinks to a URL
The Hypcr!Inks diaIog lox piovides lhe sane funclionaIily foi ciealing hypeiIinks lo a URL
in lhe Wcb Intc!!Igcncc RIch C!Icnt nain vindov and lhe Java Rcpnrt Panc! as lhe Crcatc
Hypcr!Ink diaIog lox piovides in lhe IntcractIvc paneI.
The Hypcr!Inks diaIog lox is siniIai lo lhe Crcatc Hypcr!Ink diaIog lox in lhe IntcractIvc
paneI, lul il onIy appIies lo Iinks lo URLs oi vel pages and nol lo Iinks lo docunenls.
When you enlei a URL and cIick Parsc, Wel InleIIigence dispIays lhe fieIds foi lhe URL and
foi defining lhe oplions associaled vilh lhe hypeiIink dispIay. You can choose lo cuslonize
lhe Iook and lehavioi of lhe hypeiIink lo dispIay lhe vel page in a nev vindovoi lo dispIay
a looIlip lhal desciiles lhe vel page oi URL vhen you nove lhe nouse ovei lhe hypeiIink.
Web ntelligence Advanced Report DesignLearner's Guide 114
To create a hyperIink to a URL
1. Open oi cieale a nev Wel InleIIigence docunenl using eilhei lhe Wcb Intc!!Igcncc RIch
C!Icnt oi lhe Java Rcpnrt Panc!.
2. In youi Wel InleIIigence docunenl, iighl-cIick lhe ceII oi ceIIs conlaining lhe lexl lhal you
vanl lo nake a hypeiIink and, in lhe conlexl nenu, cIick Hypcr!Inks > Ncw Hypcr!Ink.
The Hypcr!Inks diaIog lox dispIays.
3. In lhe fieId lhal dispIays in lhe Hypcr!Inks diaIog lox, lype, oi copy and pasle, lhe URL lo
vhich you vanl lhe hypeiIink lo Iead.
4. CIick Parsc.
The URL dispIays in lhe URL fieId. The fieIds foi lhe oplions lo cuslonize lhe hypeiIink
dispIay in lhe CustnmIzc thc vIsua! and IntcractInn prnpcrtIcs nf thc hypcr!Ink aiea of
lhe diaIog lox.
5. OplionaIIy, define a looIlip foi lhe hypeiIink.
6. OplionaIIy, define lhe laigel vindovfoi lhe URL. y defauIl, lhe syslenseIecls lhe cuiienl
vindov.
7. CIick OK.
115 Creating HyperlinksLearner's Guide
In youi docunenl, lhe vaIue(s) lhal you seIecled foi lhe hypeiIink nov appeai(s) as (an)
aclive hypeiIink(s).
8. Save lhe docunenl.
Activity: Creating hyperIinks in the Interactive paneI
Objectives
- In lhe Wel InleIIigence IntcractIvc paneI in InfoViev, cieale lvo docunenls -- one lo shov
saIes naigin foi aII sloies foi aII yeais and anolhei lo shov sloie delaiIs.
- In lhe saIes naigin docunenl cieale a hypeiIink lo a URL. AIso, cieale a hypeiIink on each
sloie nane lo open lhe sloie delaiIs docunenl and dispIay onIy lhe dala foi lhe sloie nane
dispIayed in lhe hypeiIink.
1. Log onlo InfoViev and veiify lhal lhe Wel InleIIigence defauIl viev and lhe defauIl
ciealing/ediling piefeiences aie sel lo IntcractIvc.
2. Using lhe cFashInnuniveise, cieale lhe hypeiIink laigel docunenl lhal dispIays sloie delaiIs
and save lhe docunenl in lhe FavnrItcs foIdei.
When lhe hypeiIink opens lhis docunenl, you vanl lhe delaiIs foi a specific sloie nane
vaIue lo dispIay so cieale a pionpl on lhe docunenl.
Wilhoul lhe pionpl, youi iepoil Iooks Iike lhis:
Save lhe docunenl as Store Details.wid.
3. Using lhe cFashInn univeise, cieale a second docunenl lhal dispIays lhe saIes naigin pei
sloie pei yeai and save lhe docunenl in lhe FavnrItcs foIdei.
Web ntelligence Advanced Report DesignLearner's Guide 116
The iepoil Iooks Iike lhis:
Save lhe second docunenl as Sales Margin per Store.wid.
4. Iion lhe Sales Margin per Store docunenl, nake lhe iepoil lilIe a hypeiIink lo a vel
page. Ioi lhe puiposes of lhe aclivily, use lhe usinessOljecls Lnleipiise seivei URL.
5. Iion lhe Sales Margin per Store docunenl, cieale a hypeiIink on lhe 5tnrc namc vaIue
lo Iink lhe lvo docunenls. Iass lhe vaIue of lhe sloie nane in lhe hypeiIink lo lhe Store
Details.wid docunenl so lhal il dispIays lhe delaiIs foi a specific sloie nane.
6. Tesl lhal lhe hypeiIinks voik in lhe IntcractIvc paneI. Save lhe docunenls and Iog off fion
InfoViev.
117 Creating HyperlinksLearner's Guide
Quiz: Creating HyperIinks
1. Hov do you cieale a hypeiIink in lhe Wel InleIIigence IntcractIvc paneI`
2. When you use lhe Crcatc Hypcr!Ink diaIog lox lo cieale a hypeiIink lo anolhei docunenl,
vhal oplions can you associale vilh lhe hypeiIink`
3. Hov do you cieale a hypeiIink in lhe Wcb Intc!!Igcncc RIch C!Icnt nain vindov oi lhe
Java Rcpnrt Panc!`
Web ntelligence Advanced Report DesignLearner's Guide 118
Lesson summary
Aflei conpIeling lhis Iesson, you aie nov alIe lo:
- Woik vilh hypeiIinks in Wel InleIIigence docunenls
- Cieale hypeiIinks in lhe Inleiaclive HTML paneI
- Cieale hypeiIinks in lhe Wel InleIIigence Rich CIienl and }ava Repoil IaneI
119 Creating HyperlinksLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide 120
Appendix A
OptionaI End of Course ChaIIenge
Activity: Using advanced querying and reporting
techniques
Objective
- Cieale a docunenl using lhe lechniques piesenled in lhis couise.
Instructions
The nanagenenl lean of lhe Xliene Spoiling Cioup iequiies a iepoil of Noilh Aneiican
saIes ly pioducl lype.
1. Cieale a nev docunenl using lhe Xtrcmc univeise lo ieluin dala foi Canada, U5A, and
McxIcn.
2. IncIude lhe foIIoving oljecls in lhe queiy:
Cnuntry, Prnduct Namc, UnIt PrIcc, QuantIty
Nntc: Do nol dispIay lhe Prnduct Namc oljecl in lhe lalIe.
The finished docunenl shouId Iook Iike lhis:
121 Optional End of Course ChallengeLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide 122
Appendix B
Creating HyperIinks with the OpenDocument
Command
Using OpenDocument to create a hyperIink to documents
In Wcb Intc!!Igcncc RIch C!Icnt and lhe Java Rcpnrt Panc!, you cieale a Iink lo a docunenl
vilh a foinuIa lhal uses lhe OpenDocunenl connand. The connand can pass delaiIed dala
lo lhe second docunenl, lased on lhe pionpled queiy fiIlei luiIl in lhe queiy of lhe Iinked
docunenl.
Ioi exanpIe, you can cieale a iepoil vilh delaiIed ievenue infoinalion foi a pailicuIai slale
and cieale anolhei iepoil vilh a slale-IeveI sunnaiy on saIes ievenue. The second iepoil can
conlain a hypeiIink on slale lhal opens lhe delaiIed ievenue iepoil foi lhe slale.
OpenDocument URL command syntax
An exanpIe of lhe synlax lo use vhen you vanl lo cieale a hypeiIink on a slale oljecl lo open
a docunenl vilh saIes delaiIs foi lhe slale appeais leIov:
="<a href="+"http://<server_name>:8080/OpenDocument/opendoc/openDocument.jsp?
"+"&sType=wid"+"&sDocName=Detailed+Sales+Report"+"&lsSEnter+State:="+Replace([State]
;"";"%20") + "> "+[State]+"</a>"
The lalIe leIov divides lhe exanpIe of synlax inlo undeislandalIe aigunenls, and piovides
an expIanalion foi each aigunenl.
Nntc: Lach of lhe synlax aigunenls aie joined vilh a pIus sign (+) in lhe foinuIa lai.
Exp!anatInn 5yntax argumcnt
The opening HTML synlax foi a hypeiIink.
"<a href="
The seivei nane and lhe connand vhich viII
le execuled on il.
http://<server_name>:8080/OpenDocument/
opendoc/openDocument.jsp?
<server_name>:8080, used in lhis exanpIe, is
specific lo lhe usinessOljecls Lnleipiise seivei.
Youcan findlhis nane dispIayedin lhe addiess
lai of youi liovsei's addiess looIlai.
Nntc: The poil is 8O8O foi Toncal vel seiveis.
The lype of docunenl lo le opened, in lhis case,
a Wel InleIIigence docunenl.
"&sType=wid"
The nane of lhe docunenl.
"&sDocName=Detailed+Sales+ Report"
123 Creating Hyperlinks with the OpenDocument CommandLearner's Guide
Exp!anatInn 5yntax argumcnt
Nole lhal spaces in lhe nane of lhe docunenl
aie iepIaced vilh a + sign. 2O can le used in
pIace of lhe +. 2O is lhe HTML encoding
synloI foi a space.
This paianelei can le sulsliluled vilh lhe
sDocID.
The pionpl paianelei vhich viII le passed lo
lhe docunenl leing opened.
"&lsSEnter_State:="+Replace( [State];"
";"%20")
Nolice lhal lhis aigunenl has lo nalch exaclIy
vilh lhe pionpl ciealed in lhe fiisl docunenl.
In lhis case, a singIe paianelei is leing passed
(IsS).
AddilionaI paianeleis aie avaiIalIe:
- IsM foi nuIlipIe vaIues
- IsR foi a iange of vaIues
The oljecl nane in liackels, |Slalej indicales
lhe dala fion lhe nain iepoil lo le passed lo
lhe Iinked iepoil.
The RepIace connand is used vilh lhe vaIue
lo iepIace spaces in lhe vaIue vilh lhe HTML
synloI foi a space.
MuIlipIe pionpls can le Iisled in lhe code. You
jusl conlinue lo sliing lhen logelhei vilh lhe
+ chaiaclei lo concalenale lhe pieces.
Requiied HTML encoding and lhe oljecl nane
lhal indicales lo lhe docunenl vhich dala lo
shov in lhe lalIe.
t">"+ [State]
Once you have foinalled lhe coIunn in lhe
Wel InleIIigence lalIe, lhe Slale vaIues in lhis
case appeai as hypeiIinks.
The cIosing HTML code foi a hypeiIink.
"</a>"
To use the OpenDocument command for hyperIinks
1. In youi Wel InleIIigence docunenl, seIecl lhe vaIues lhal you vanl lo dispIay as hypeiIinks.
2. CIick lhe 5hnw/HIdc Fnrmu!a lullon on lhe Repoiling looIlai.
Web ntelligence Advanced Report DesignLearner's Guide 124
3. CIick lhe Fnrmu!a EdItnr lullon on lhe IoinuIa looIlai.
Nov you aie ieady lo define lhe foinuIa lo appIy a hypeiIink lo lhe seIecled vaIues.
4. Type lhe hypeiIink synlax in lhe Fnrmu!a zone of lhe Fnrmu!a EdItnr and cIick OK.
Nntc: Veiify lhal lheie aie no lIank spaces in lhe hypeiIink foinuIa, oi lhe hypeiIink viII
nol voik.
To dispIay the hyperIinks
1. In youi Wel InleIIigence docunenl, seIecl lhe vaIues lhal you vanl lo dispIay as hypeiIinks.
2. CIick lhe PrnpcrtIcs lal.
3. CIick + lo expand lhe DIsp!ay seclion.
4. CIick lhe Tcxt fieId nexl lo lhe Rcad cc!! cnntcnt as oplion and lhen cIick lhe diop-dovn
aiiov.
5. SeIecl Hypcr!Ink fion lhe Iisl of oplions.
The vaIue seIecled dispIays as a hypeiIink.
More about using the OpenDocument URL
Keep in nind lhe foIIoving inpoilanl poinls vhen using lhe OpenDocunenl URL connand.
URL syntax
The lypicaI URL synlax is as foIIovs:
- Ioi }AVA inslaIIalions:
http://<hostname>:<port>/OpenDocument/opendoc/openDocument.jsp?
- Ioi COM inslaIIalions:
http://<hostname>:<port>/OpenDocument/opendoc/openDocument.jsp?
125 Creating Hyperlinks with the OpenDocument CommandLearner's Guide
y defauIl, usinessOljecls Lnleipiise XI 3.O/3.1 uses lhe <hoslnane> as lhe seivei nane. The
poil is 8O8O foi Toncal vel seiveis and 8O foi IIS vel seiveis (vhich is lhe defauIl HTTI poil
and can le onilled).
The foIIoving aie exanpIe URLs vheie lhe seivei nane is "paiis":
- TOMCAT:
http://paris:8080/OpenDocument/opendoc/openDocument.jsp?
- IIS:
http://paris/OpenDocument/opendoc/openDocument.jsp?
No bIank spaces aIIowed in the hyperIink
Theie can le NO SIACLS in lhe Iink, excepl vhen a univeise oljecl nane is incIuded vilhin
| j liackels.
If youincIude spaces in lhe Iink, lhen lhe Iink viII le liuncaledaflei lhe space andlhe ienaindei
of lhe Iink viII nol le execuled.
Theie aie lhiee diffeienl nelhods foi handIing spaces:
- Use lhe "+" chaiaclei, as shovn in lhe pievious exanpIe.
- Use "2O" in lhe haid-coded aigunenls.
- Use URLLncode() vhen an aigunenl, such as dala ieluined ly a univeise oljecl, has
enledded spaces in lhe dala.
Constructing the Iink with & as deIimiter
The aigunenls aie deIiniled ly lhe & chaiaclei.
Finding more information
Ioi noie infoinalion using lhe OpenDocunenl URL connand vilh Wel InleIIigence
docunenls, iefei lo lhe docunenl deIiveied on lhe CD vilh Wel InleIIigence XI 3.O/3.1,
Pcrfcrning cn-rcpcr| ana|qsis ui|n lco |n|c||igcncc Chaplei 13, "Linking lo olhei docunenls" foi
noie infoinalion on using lhe OpenDocunenl URL connand vilh Wel InleIIigence
docunenls.
Web ntelligence Advanced Report DesignLearner's Guide 126
Appendix C
Dimensions and DetaiIs
Understanding dimensions and detaiIs
As an advancediepoil designei, youaie in a lellei posilion lo connunicale youi oiganizalion's
iepoiling needs lo lhe univeise designei. You can le noie effeclive in lhal ioIe vhen you
undeisland lhe diffeiences lelveen dinension oljecls and delaiI oljecls, as veII as hov lhe
univeise designei decides lo define an oljecl as a dinension oi a delaiI.
The lalIe leIov desciiles dinensions and delaiIs and lheii diffeiences. The key diffeiences
aie lhal dinensions can:
- e pail of lhe scope of anaIysis, lo enalIe diiIIing on lhe dinension.
- Meige vilh an oljecl fionanolhei dala souice lo synchionize lheii iespeclive dala souices.
DelaiIs cannol seive lhe lvo puiposes alove. So vhen you connunicale youi iepoiling needs
lo a univeise designei, you vanl lo considei vhal oljecls you vanl lo use vhen defining scope
of anaIysis foi diiIIing, and vhal oljecls you vanl lo use foi synchionizing diffeienl dala
souices.
DctaI!s DImcnsInns
Iiovide desciiplive dala aloul a dinension.
DelaiIs aie aIvays associaled vilh lhe
Reliieve lhe dala lhal piovides lhe lasis foi
anaIysis in a iepoil.
dinensionfoi vhich lhey piovide addilionaI
infoinalion.
Can have aII dala lypes, chaiaclei, dale, oi
nunlei.
Can have aII dala lypes, chaiaclei, dale, oi
nunlei, lul lypicaIIy ieliieve chaiaclei-lype
dala, foi exanpIe, cuslonei nanes, sloie nanes,
oi dales.
Can conlain caIcuIalions such as: Reluin
Dale, Age, Days lo Ship.
Can conlain caIcuIalions such as: Reluin Dale,
Age, Days lo Ship.
Cannol le pail of lhe scope of anaIysis foi
diiIIing.
Can le pail of lhe scope of anaIysis so iepoil
useis can diiII dovn on lhe dinensions.
Cannol neige vilh an oljecl fion a dala
souice lo synchionize diffeienl dala souices.
Can neige vilh an oljecl fion anolhei dala
souice lo synchionize diffeienl dala souices.
127 Dimensions and DetailsLearner's Guide
Understanding the impact of changing the object quaIification
When youi iepoiling needs changing and you discovei lhe need lo change a dinension lo a
delaiI, oi lo change a delaiI lo a dinension, lhe change can inpacl youi iepoils. When youi
univeise designei consideis naking such a change, discuss and pIan foi lhe possilIe
consequences desciiled in lhis seclion.
When a univeise designei changes an oljecl fion a delaiI lo a dinension, sonelines:
- AddilionaI oljecls aie avaiIalIe in lhe hieiaichies vhen you diiII in lhe iepoil.
- Moie oljecls aie avaiIalIe foi synchionizalion lelveen dala souices.
When a univeise designei changes an oljecl fion a dinension lo a delaiI, sonelines:
- Oljecls disappeai fion lhe hieiaichies and exisling diiII docunenls have oljecls nissing
fion lhe scope of anaIysis.
- Oljecls aie no Iongei al lhe lop IeveI in lhe cIass. Inslead, lhey appeai as an associaled oljecl.
The iisk is lhal lhey nay le associaled vilh lhe viong oljecl.
- Oljecls appeai avaiIalIe foi dala synchionizalion vhen lhey nay nol le conpalilIe vilh
oljecls fion olhei dala souices.
Repoils vhich use lhe dinension oljecl lo neige dala fion nuIlipIe dala souices no Iongei
funclion piopeiIy lecause you cannol neige delaiI oljecls.
Review: Dimensions and detaiIs
The eIashion Iuichasing depailnenl iequiies nev iepoils. Read lhe usei needs leIov and
decide vhich oljecls lhe univeise designei defines as dinensions, vhich oljecls lhe univeise
designei defines as delaiIs, and vhy.
1. A gioup of iepoils incIude Sloie nane, Iioducl Iine, SKU desciiplion, Quanlily soId, and
CoIoi. The fiisl foui oljecls ieliieve inpoilanl dala foi lhe iepoils. The CoIoi oljecl appeais
in onIy one iepoil. Whal oljecl lype did lhe univeise designei assign lo lhe oljecls and
vhy`
2. The Iuichasing diiecloi vanls lo anaIyze lhe Iioducl Line infoinalion and lo diiII dovn
lo Calegoiy, SKU Desciiplion, and Iionolion. He does nol vanl lo diiII lo SKU nunlei oi
CoIoi.
3. A Meichandising nanagei has access lo noie lhan one dala souice - an LxceI Spieadsheel
and a nunlei of univeises. She vanls lo liing lhe infoinalion fionlhese diffeienl souices
inlo one lalIe and lo neige foi dala synchionizalion on lhe Sloie nane and Iioducl Iine
oljecls.
Web ntelligence Advanced Report DesignLearner's Guide 128
Answer Key
This seclion conlains lhe ansveis lo lhe ievievs and/oi aclivilies foi lhe appIicalIe Iessons.
129 Answer KeyLearner's Guide
Web ntelligence Advanced Report DesignLearner's Guide 130
Review: Web InteIIigence core report design
Page 2
1. A Wel InleIIigence docunenl consisls of lhiee conponenls. Whal aie lhey`
Answcr:
A Wel InleIIigence docunenl conlains:
A dala piovidei oi queiy
A iepoil
Iocks of dala
2. A queiy fiIlei conlains lhiee conponenls. Whal aie lhey`
Answcr:
A queiy fiIlei conlains:
An oljecl
An opeialoi
An opeiand
3. Whal oljecl lype does nol have a Iisl of vaIues`
Answcr:
A neasuie
4. When you Iisl vaIues in a foinuIa, vhal nusl you use lo sepaiale lhe vaIues`
Answcr:
A seni-coIon
5. Whal aie lhe lvo lenefils piovided vhen you appIy a lieak lo a lalIe`
Answcr:
You can use lhe lieak lo:
Cioup dala
DispIay suns
6. Whal aie lhe diffeiences anong a queiy fiIlei, a iepoil fiIlei, and a lIock fiIlei`
Answcr:
A queiy fiIlei Iinils lhe dala ieluined fion lhe dalalase.
A lIock fiIlei aIIovs seIecled dala lo dispIay in a singIe lIock and hides lhe olhei dala.
Aiepoil fiIlei aIIovs seIecled dala lo dispIay in a page and hides lhe olhei dala. The iepoil
fiIlei appIies lo aII dala lIocks on lhe page.
7. Whal is lhe diffeience lelveen a seclion and a lieak`
131 Answer KeyLearner's Guide
Answcr:
Aseclion inpacls lhe vhoIe iepoil page, a lieak inpacls lhe lalIe oi ciosslal lo vhich you
appIy lhe lieak.
A seclion aIIovs you lo dispIay nuIlipIe lIocks of dala on lhe sane page. A lieak does nol
aIIov you lo dispIay nuIlipIe lIocks of dala on lhe sane page.
8. Whal is lhe diffeience lelveen an ascending oi descending soil and a cuslon soil`
Answcr:
Ascending and descending soils inpacl lhe coIunn of lhe lIock lo vhich you appIy lhe
soil.
Cuslon soils inpacl lhe dala in an oljecl. When you appIy a cuslon soil lo an oljecl, lhe
cuslon soil inpacls aII lhe lIocks lhal use lhe oljecl.
9. Why puige lhe dala in youi docunenl`
Answcr:
You can use lhe puige funclion:
When you vanl a docunenl lo iefiesh vhen lhe iepoil usei opens il, lul you do nol
vanl lhe iepoil usei lo see lhe exisling dala, foi ieasons of secuiily, foi exanpIe.
When you vanl lo send a dala-heavy docunenl lo a iepoil usei. You can nake lhe
docunenl Iighlei vhen you puige lhe dala. ConsequenlIy, lhe docunenl aiiives noie
quickIy.
1O. Whal is lhe diffeience lelveen a dinension and a delaiI`
Answcr:
A dinension dispIays vaIues lhal iepoil useis vanl lo see in lheii docunenls. You can use
a dinension foi a scope of anaIysis. You can neige a dinension vilh a dinension fion
anolhei dala souice lo synchionize lvo diffeienl dala souices.
A delaiI piovides addilionaI, conpIenenlaiy infoinalion lo lhe infoinalion conlained in
a dinension and nusl le associaled vilh a dinension. A delaiI cannol seive in a scope of
anaIysis oi neige vilh an oljecl fionanolhei dala souice lo synchionize lvo diffeienl dala
souices.
11. You have lvo queiies on lvo diffeienl dala souices. Queiy 1 ieluins 1O iovs foi RcgInn.
Queiy 2 ieluins 12 iovs foi RcgInn_Arca . Yousynchionize lhe lvo dala souices ly neiging
lhe RcgInn and RcgInn_Arca oljecls.
Hov nany iovs appeai aflei lhe synchionizalion`
Answcr:
When lhe RcgInn and RcgInn_Arca oljecls conlain dala in lhe sane foinal and case, aflei
synchionizalion:
Web ntelligence Advanced Report DesignLearner's Guide 132
12 iovs appeai vhen lhe 1O vaIues foi RcgInn nalch sone of lhe 12 vaIues foi
RcgInn_Arca .
22 iovs appeai vhen 1O vaIues foi RcgInn do nol nalch lhe 12 vaIues foi RcgInn_Arca.
When lhe RcgInn and RcgInn_Arca oljecls conlain dala in diffeienl foinal oi case, aflei
synchionizalion 22 iovs appeai. Wel InleIIigence handIes siniIai vaIues vilh diffeienl
foinal oi case as diffeienl vaIues.
12. You have a iepoil vilh lhe oljecls RcgInn, Ycar, and 5a!cs rcvcnuc in Queiy 1, and you
have anolhei iepoil on a diffeienl dala souice vilh RcgInn, Arca, and 5a!cs tnta! in Queiy
2. Which oljecls do you choose lo neige lo synchionize lhe infoinalion in one lalIe`
Answcr:
You choose lhe RcgInn oljecls lecause lhey aie lhe onIy connon dinensions. You cannol
neige a neasuie so you cannol use lhe 5a!cs rcvcnuc and 5a!cs tnta! oljecls.
13. When yousynchionize lvo queiies fiondiffeienl dala souices, vhal iuIes nusl youiespecl`
Answcr:
Respecl lhe foIIoving iuIes:
Oljecl nanes can diffei.
The dala lype foi lhe neiged oljecls nusl le lhe sane.
Dala nusl have lhe sane case lecause lhe dala piovidei is case-sensilive.
You can onIy synchionize on dinensions.
You can onIy dispIay neasuies vilh synchionized dinensions. When you use lhen foi
anolhei puipose, dupIicale vaIues appeai.
14. Can you synchionize lhe dala lelveen a Wel InleIIigence docunenl and an LxceI
spieadsheel`
Answcr:
In Wel InleIIigence XI 3.x, vhen a dinension appiopiiale foi neiging exisls in lhe lvo
docunenls, yes, you can.
133 Answer KeyLearner's Guide
Quiz: Advanced Query Techniques
Page 28
1. Whal aie lhe lhiee lypes of queiy lechniques used in lhis Iesson`
Answcr: Conlining, Sulqueiy, and DupIicaling a queiy lo luiId anolhei.
2. If you veie lo use lhe UNION opeialoi lo conline queiies, vhal vouId le lhe iesuIl`
Answcr: The iesuIl ieluins aII iecoids lhal salisfy one of lhe lvo condilions. This is equivaIenl
lo using an OR lelveen queiy fiIleis.
3. If you veie lo use lhe INTLRSLCTION opeialoi lo conline queiies, vhal vouId le lhe
iesuIl`
Answcr: OnIy iecoids lhal nalched ALL ciileiia vouId le ieluined. This is lhe equivaIenl
of doing an AND lelveen queiy fiIleis.
4. If you veie lo use lhe MINUS opeialoi lo conline queiies, vhal vouId le lhe iesuIl`
Answcr: AII iecoids lhal nalch lhe fiisl queiy condilion and nol lhe second condilion.
Wheie you pIace lhe queiies deleinines vhich is lhe fiisl condilion and vhich is lhe second
condilion.
5. Lisl lvo ieasons vhy you nighl vanl lo use conlined queiies.
Answcr:
To nake lhe consliuclion of lhe queiy easiei.
When il is nol possilIe lo appIy lhe iequiied queiy fiIleis using ooIean Iogic.
6. Can you do a sulqueiy and ieluin exaclIy lhe sane iesuIls as a conlined queiy`
Answcr: Depending on lhe queiy, yes.
7. Which sulqueiy opeiand lype neans lhal Wel InleIIigence viII Iook foi onIy one inslance
of a vaIue fion lhe sulqueiy lhal neels lhe queiy fiIlei`
a. ALL
l. ANY
Answcr: ANY. The Any oplion neans lhal Wel InleIIigence onIy Iooks foi one inslance of
a vaIue fion lhe sulqueiy lhal neels lhe queiy fiIlei. If il finds one, il lhen ceases lhe
conpaiison vilh lhe ienaindei of lhe sulqueiy oulpul.
8. Why vouId you choose lo do a conlined queiy ialhei lhan a sulqueiy`
Answcr: Conlined queiies lend lo le faslei al ieluining lhe dala.
9. When you change a dala souice, vhal can you choose lo do lo lhe oljecls in lhe oiiginaI
queiy`
Answcr: You can nap lhenlo oljecls in lhe nevdala souice oi deIele lhenfionlhe queiy.
Web ntelligence Advanced Report DesignLearner's Guide 134
Quiz: CaIcuIation Contexts
Page 49
1. Whal is an inpul conlexl`
Answcr:
The inpul conlexl is lhe Iisl of dinensions lhal aie incIuded in lhe caIcuIalion ilseIf.
2. Whal is an oulpul conlexl`
Answcr: The oulpul conlexl is lhe dinension IeveI in vhich lhe caIcuIalion is lo le dispIayed
in lhe iepoil. Ioi exanpIe, lhe oulpul conlexl can le lhe dinension dispIayed al lhe iov
IeveI, lhe dinension dispIayed al lhe lieak IeveI, and so on.
3. Which of lhe foIIoving is an exlended synlax conlexl opeialoi`
NoIiIlei()
IoiLach
Iock
Answcr: IoiLach
NoIiIlei() is a funclion. Iock is an exlended synlax keyvoid.
4. Which of lhe foIIoving is an exlended synlax keyvoid`
NoIiIlei()
IoiLach
Seclion
Answcr: Seclion
135 Answer KeyLearner's Guide
Quiz: Character and Date String Functions
Page 71
1. Nane al Ieasl lhiee chaiaclei sliing funclions used in lhis Iesson.
Answcr: Choice of Righl(), Sulsli(), Ios(), RepIace(), Lenglh()
2. To find lhe occuiience of a conna in an oljecls vaIue, vhich funclion vouId you use`
Answcr: Ios()
3. Whal is lhe synlax foi lhe RepIace() funclion`
Answcr: RepIace(|sliingj , oId sliing , nev sliing)
4. When vouId you choose lo use lhe Lenglh() funclion`
Answcr: To idenlify lhe Ienglh of a fieId.
5. Cive an exanpIe of sliing concalenalion.
Answcr: Laslnane+ , + Iiislnane
6. If you vanl lo cieale a foinuIa lo ieluin lhe nunlei of yeais lelveen lvo dales, vhal
vouId lhe synlax le`
Answcr: =Dayselveen(fiisl dale,second dale)/365.25
7. Can you do caIcuIalions on a dale`
Answcr: Yes
Web ntelligence Advanced Report DesignLearner's Guide 136
Quiz: Using If Logic
Page 86
1. Whal is anolhei lein foi lhe Iogic used ly lhe If() funclion`
Answcr: If...Then...LIse Iogic
2. Which of lhe foIIoving aie exanpIes of vhy you nighl use lhe If() funclion lo gioup vaIues
in a vaiialIe:
- To dispIay calegoiies of vaIues
- To shov vaIues aggiegaled al highei IeveIs of delaiI
Answcr: 1 and 3
3. Tiue/IaIse. You can use lhe If() funclion lo define a vaiialIe so lhal a diffeienl caIcuIalion
is used depending on lhe vaIue ieliieved ly lhe oljecl specified in lhe vaiialIes foinuIa.
Answcr: Tiue
137 Answer KeyLearner's Guide
Quiz: AdditionaI Reporting Techniques
Page 104
1. When you appIy a slandaid caIcuIalion such as a Sunoi an Aveiage on a coIunn in a lalIe
vilh a lieak, vheie is lhe caIcuIalion inseiled`
- In a dala ceII
- In lhe lieak foolei
- In lhe seclion
- In lhe lieak headei
Answcr: In lhe lieak foolei.
2. Hov do you foinal a lieak`
Answcr:
SeIecl lhe coIunn vilh lhe lieak and go lo lhe ieaks foIdei in lhe PrnpcrtIcs lal.
3. Which funclion can you use lo deleinine vhelhei a chaiaclei sliing nalches a pailicuIai
pallein`
Answcr: Malch()
4. Whal is lhe synlax foi ciealing a iunning sun on Maigin vilh a iesel on Yeai`
Answcr: =RunningSum([Margin] ; [Year]))
5. Which funclion vouId you use if you vanl lo shov lhe SQL foi a pailicuIai queiy`
Answcr: Dalapiovidei(SQL)
6. Which funclion can you use lo oveiiide a iepoil fiIlei oi a ianking`
Answcr: NoIiIlei()
7. Hov can you dispIay a iepoil fiIlei`
Answcr: Wilh lhe DrI!! FI!tcrs ceII oi lhe DiiIIIiIlei() funclion.
Web ntelligence Advanced Report DesignLearner's Guide 138
Quiz: Creating HyperIinks
Page 118
1. Hov do you cieale a hypeiIink in lhe Wel InleIIigence IntcractIvc paneI`
Answcr: Wilh lhe Crcatc Hypcr!Ink diaIog lox.
2. When you use lhe Crcatc Hypcr!Ink diaIog lox lo cieale a hypeiIink lo anolhei docunenl,
vhal oplions can you associale vilh lhe hypeiIink`
Answcr:
The oplions incIude:
Refieshing lhe laigel docunenl vhen il opens.
Linking lo a specific docunenl inslance.
Linking lo a specific aiea in lhe docunenl.
Iassing a pionpl vaIue lo lhe docunenl.
Cuslonizing lhe Iook and lehavioi of lhe hypeiIink, foi exanpIe, lo have lhe hypeiIink
dispIay lhe docunenl in a nevvindovoi lo dispIay a looIliplhal desciiles lhe docunenl
vhen you nove lhe nouse ovei lhe hypeiIink.
3. Hov do you cieale a hypeiIink in lhe Wcb Intc!!Igcncc RIch C!Icnt nain vindov oi lhe
Java Rcpnrt Panc!`
Answcr:
To cieale a hypeiIink lo:
- A URL oi velsile, you use lhe Hypcr!Inks diaIog lox.
- Anolhei docunenl, you use lhe OpenDocunenl connand.
139 Answer KeyLearner's Guide
Review: Dimensions and detaiIs
Page 128
1. A gioup of iepoils incIude Sloie nane, Iioducl Iine, SKU desciiplion, Quanlily soId, and
CoIoi. The fiisl foui oljecls ieliieve inpoilanl dala foi lhe iepoils. The CoIoi oljecl appeais
in onIy one iepoil. Whal oljecl lype did lhe univeise designei assign lo lhe oljecls and
vhy`
Answcr: The univeise designei defines lhe Sloie nane, Iioducl Iine, SKU desciiplion and
Quanlily soId as dinensions and defines lhe CoIoi as a delaiI.
2. The Iuichasing diiecloi vanls lo anaIyze lhe Iioducl Line infoinalion and lo diiII dovn
lo Calegoiy, SKU Desciiplion, and Iionolion. He does nol vanl lo diiII lo SKU nunlei oi
CoIoi.
Answcr: The univeise designei defines SKUnunlei and CoIoi as delaiIs lo keep lhe defauIl
hieiaichy easy lo iead and defines lhe olhei oljecls as dinensions.
3. A Meichandising nanagei has access lo noie lhan one dala souice - an LxceI Spieadsheel
and a nunlei of univeises. She vanls lo liing lhe infoinalion fionlhese diffeienl souices
inlo one lalIe and lo neige foi dala synchionizalion on lhe Sloie nane and Iioducl Iine
oljecls.
Answcr: The univeise designei defines lhe Sloie nane andIioducl Iine oljecls as dinensions
so lhe neichandising nanagei can neige lhen.
Web ntelligence Advanced Report DesignLearner's Guide 140
Notes

Notes

Notes

Notes

Potrebbero piacerti anche