反馈已提交

网络繁忙

You are viewing 5.1 help doc. More details are displayed in the latest help doc.

Multi-conditional assignment

  • Recent Updates: April 12, 2022
  • 1. Overview

    1.1 Expected effect

    Sometimes users need to assign different values to different fields at the same time.

    Example 1: The school personnel type field assigns 12 and 21 to staff, 1 and 2 to students, and the rest to others, as shown in the following figure.

    37.png

    Example 2: Assign the values of "Nanjing" and "Wuxi" as "Central Area" and "Key Area", and other areas as "Other", if the value is "Central Area", the value will be "A", "Key Area" will be "B", and "Other" will be "C", as shown in the figure below.

    38.png

    1.2 Implementation idea

    This is achieved using the Switch function and IF function.

    2. Example 1

    Example data: group assignment.xlsx

    Upload the Excel data set to FineBI as shown below.

    39.png

    2.1 Create Self-Service dataset

    Create the Self-Service dataset, select the Excel dataset that has been uploaded, and check the sample fields as shown below.

    40.png

    2.2 Multi-conditional assignment

    Click "+" to add "New Column", as shown in the following figure.

    41.png

    2.2.1 Method 1

    Name the new column "Multi-Conditional Assignment", enter the formulaIF(OR(type="12",type="21"), "staff", IF(OR(type="1",type="2"), "student", "other")), and click "OK", as shown in the following figure.

    42.png

    Formula Description.

    FormulaDescription
    IF(OR(type="1",type="2"),"student","other")

    If the type is either 1 or 2, assign "student", otherwise assign "other".

    IF(OR(type="12",type="21"),"staff",IF(OR(type="1",type="2"),"student","other"))If the type is either 12 or 21, the value is "staff"; otherwise, if the type is either 1 or 2, the value is "student"; otherwise, the value is "other".

    2.2.2 Method 2

    Name the new column "switch assignment" and enter the formula:SWITCH(type,"12","staff","21","staff","1","student","2","student"), click "OK", as shown below.

    43.png

    Add "New column" again, and assign the other data that does not belong to "switch assignment" to "other", enter the formula: IF(switch assignment = NULL, "other", switch assignment), as shown below.

    44.png

    2.3 Effect view

    See Section 1.1 of this document for details.

    3. Example 2

    Example using "Sales DEMO>Customer Dimension Table" data.

    3.1 Create Self-Service dataset

    Create the Self-Service dataset and select the "CustomerID""Province" "City"  fields under the "Customer Dimension Table" as shown below.

    45.png

    and filter out the data from Jiangsu Province as shown in the following figure.

    46.png

    3.2 Multi-conditional assignment

    Click "+" to add "New Column", as shown in the following figure.

    47.png

    Name the new column "Multi-Condition Assignment", enter the formula:IF(Province="Jiangsu province",IF(City="Nanjing city", "central area",IF(City="Wuxi city", "key area", "other"), "other") , "other"), click "OK", as shown in the following figure.

    48.png

    Create the new column again, name the new column "Assignment", use the SWITCH function to assign the fields that meet the corresponding conditions, enter the formula: SWITCH(multi-conditional assignment, "central area", "A", "key area", "B", "other", "C") , and click "OK", as shown in the figure below.

    49.png

    You can continue with other operations.

    3.3 Effect view

    See Section 1.1 of this document for details.

    Attachment List


    Theme: Advanced Data Analyis
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    售前咨询电话

    400-811-8890转1

    在线技术支持

    在线QQ:800049425

    热线电话:400-811-8890转2

    总裁办24H投诉

    热线电话:173-1278-1526

    文 档反 馈

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

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

    不再提示

    10s后关闭