In this blog post I will discuss the use of the For Each formula in a Webi report. ForEach is one of three context operators in Webi (the other two are “IN” and “ForAll”). The ForEach operators allows adding extra dimensions to the existing input context.
Consider the table below containing a list of Customer numbers and their respective invoices. Let’s say we want to count invoices for each customer where the invoice volume is greater than 10.
Here is the formula for doing so
=Sum(Count([Invoice No]) ForEach([Invoice No];[Customer Number]) Where ([Volume CY YTD]>10))
I will create a new measure and input the formula above within it
Then I will drag that measure next to the “Invoice No” column. Here is the outcome.
As you could observe the formula is correctly counting the invoices that meet the defined requirements.