Skip to Content

Hi All,

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:

In context operator – when / why we use?

For to me using In context operator to specifies dimensions explicitly in a context.

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.

Max ([Sales Revenue] In ([Year];[Quarter])) In ([Year])

Finally Your report looks like this:

In-function-webi-report.png

ForEach context operator – when and why we use?

For to me using the ForEach operator to add dimensions to a context.

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:

Max ([Sales Revenue] ForEach ([Quarter])) In ([Year])

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:

In-function-webi-report.png

ForAll context operatorwhen and why we use?

For to me using the ForAll context operator to remove dimensions from a context.

Example:- You have a report showing Year, Quarter and Sales Revenue and you want to add a column that shows the Yearly total revenue.

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:

ForAll-operator-in-webi-report.png

I hope you enjoyed lots and learned something new while reading this document.

Cheers,

Amrendra

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Amrendra Kumar Post author

    Hi Neil,

    Happy Christmas in Advance!

    Appreciate on you comment, in next blog post sure i will add on more about input/ output context.

    Also, your comment is not appearing in my blog post, i find it in mail any specific reason?

    If comment appearing it’s appreciation for me also.

    Thanks & Regards,

    amrendra

    (0) 

Leave a Reply