反馈已提交

网络繁忙

IN

  • Last update:  2023-06-28
  • Overview

    Version

    FineBI Version
    6.0.9

    Functions

    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

    Notes

    1. All parameters in the IN function must be of the same type.

    2. 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".

    1.png

    Example

    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 InformationCreate 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.

    1.png

    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.png

    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).

    1.png

    In this way, you can only view the contract volume of standing agreements in the component.

    2.png

    The contract volume of standing agreements displayed with KPI indicator card is shown below:

    33.png

    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.

    /

     

     


    附件列表


    主题: Advanced Data Analyis
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

    feedback

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭