IN is used to evaluate whether the result of the expression belongs to the set constructed by para 1, para 2, para 3, and so on. If it belongs, the result is 1. If not, the result is 0.
Syntax
IN(exp,para1,para2,para3,...)
Evaluate whether the result of the expression belongs to the set constructed by para 1, para 2, para 3, and so on.
Parameter 1
exp
Any type of expression (cannot be NULL)
Parameter 2
para1,para2,para3,...
Constant/constant expression/component parameter of any type
All parameters in the IN function must be of the same type.
When parameter 1 of IN is a component parameter and is assigned multiple values (such as a parameter bound to a multiselect text filter component). Component error: "The first parameter of IN cannot be a multivalued parameter".
Find the contract volume of standing agreement and standing agreement order in the Contract Information table.
1. Create a subject, and upload example data: Contract Information. Create a component based on this table. Add a calculation indicator to evaluate whether the contract type is a standing agreement.
If the value of Contract Type is Standing Agreement or Standing Agreement Order, the contract is a standing agreement. Enter the formula: IN(Contract Type, "Standing Agreement Order", "Standing Agreement").
Note: The Contract Type in the formula is not entered manually. Instead, you can select it by clicking the field on the left.
Drag Contract ID and Contract Type to Dimensions, Whether the Contract Type is a Standing Agreement to Indicators. It can be found that the value of Standing Agreement and Standing Agreement Order is 1 while the value of other types is 0.
2. Calculate the contract volume of standing agreements. Add a calculation indicator, and enter the formula: DEF_ADD(SUM_AGG(Contract Volume),[],Whether the Contract Type is a Standing Agreement).
In this way, you can only view the contract volume of standing agreements in the component.
The contract volume of standing agreements displayed with KPI indicator card is shown below:
3. More examples:
Formula
Result
Note
IN(1,1,2,3)
1
/
IN(City,"Tokyo","New York","London")
Rows with the city field values that equal to Tokyo, New York, or London = 1, all other rows = 0.
DEF(SUM(Sales Volume),[],[IN(City,$Component Parameter)])
Calculate the total sales amount of the cities that belong to the component parameter value.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy