FineBI Version
6.0.9
The IN function is used to determine whether the result of an expression belongs to the set constructed by parameter 1, parameter 2, parameter 3, ..., and parameter N. If the result of the expression belongs to the set, the returned value is 1. Otherwise, the returned value is 0.
Syntax
IN(Exp,Para1,Para2,Para3,...)
Used to determine whether the result of an expression belongs to the set constructed by parameter 1, parameter 2, parameter 3, ..., and parameter N.
Parameter 1
exp
Any expression of any type (not NULL)
Parameter 2
Para1,Para2,Para3,...
Constant/Constant expression/Component parameter of any type
1. All parameters in the IN function must be of the same type.
2. When parameter 1 of the IN function is a component parameter and is assigned multiple values (for example, a component parameter bound to a filter component and configured with multiple values), a component error will occur, saying "The first parameter of IN cannot be a multivalued parameter", as shown in the following figure.
For example, you can use the function to calculate the contract amounts of long-term orders in Contract Fact Table.
1. Create an analysis subject, and upload the data table Contract Fact Table. Create a component with the table, select Add Calculation Field to add a calculation field, and name the field Long-term Order or Not.
When the contract type is Long-term agreement or Long-term agreement orders, the order belongs to the long-term order. Enter the formula: IN(Contract Type,"Long-term agreement orders","Long-term agreement")
When you add fields to the component, the values for long-term orders are set to 1, while all others are set to 0, as shown in the following figure.
2. To calculate the contract amounts of long-term orders, add a calculation field with the formula DEF_ADD(SUM_AGG(Total Amount),[],Long-term Order or Not).
Only the contract amounts of long-term orders are displayed in the component, as shown in the following figure.
You can display the total contact amount in a KPI card, as shown in the following figure.
2. The following table shows more examples.
Formula
Result
Remarks
IN(1,1,2,3)
1
/
IN(City,"Beijing","Shanghai","Guangzhou")
If the value of the City field in a row is Beijing, Shanghai, or Guangzhou, the returned value in the row is 1. Otherwise, the returned value is 0.
DEF(SUM(Sales Amount),[],[IN(City,$Component Parameter)])
The formula is used to calculate the total sales amount for cities that match the component parameter values.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy