Stone, in Other Words To Solve Two Problems at One Time With A Single Action
Stone, in Other Words To Solve Two Problems at One Time With A Single Action
In this blog post Getting to know about the Context Operators (IN, ForEach and ForAll). First let me
explain on this; IN, ForEach and ForAll these three operators are called Context operators. Do you
know, why today i would like to share my knowledge about this topic because context operators
mostly used in webi report.
Even you know by using (IN, ForEach and ForAll) operators; you just like Kill Two words with one
stone, in other words to solve two problems at one time with a single action.
Have you ever noticed that IN, ForEach and ForAll these three webi functions like poweful
keywords which most/ mostly serachable in Google search engine. Also in this blog post i covered
all aspects about context operators; when any why required at the time of creating webi report.
I explain on these three operators below using an example:
Example:- you have a report showing Year and Sales Revenue, but our requiremnent is to add one
more column which showing maximum revenue by quarter. also you have the Quarter object in
query panel but you do not include this dimension in the report block. Instead, you want to include an
additional column to show the maximum revenue by quarter in each year.
Solution:- By Using the In context operator, you can achieve the Max Quarterly Revenue using
below formula.
Example:- How To show the maximum revenue for each Quarter in a report which having the
Quarter dimension in query panel but does not include it in the block:
Solution:- Using the ForEach context operator, you can achieve the same result with using below
formula:
How does work/ Above formula explanation:- You know Year dimension is the default input context
in the block. So, by using the ForEach operator, you add the Quarter dimension to the context, by
giving an input context of ([Year];[Quarter]).
Finally Your report looks like this:
Solution:- Using the ForAll context operator, you can achieve the same result with using below
formula:
Sum([Sales Revenue] ForAll ([Quarter]))
How does work/ Above formula explanation:- By default you have input context (Year; Quarter), for
total revenue by year the input context needs to be (Year); Therefore, you can remove Quarter from
the input context by specifying ForAll ([Quarter]) in the formula, which looks like above.
Note:- You can also achieve the same result by using the the In operator; in this case the formula is
below:
Sum([Sales Revenue] In ([Year]))
Finally Your report looks like this:
I hope you enjoyed lots and learned something new while reading this document.