Conditional Summation and Count

  • Last update:January 29, 2026
  • Overview

    In Excel:

    Conditional counting (COUNTIF/COUNTIFS): used to count the number of data records that meet specified condition(s).

    Conditional summation (SUMIF/SUMIFS): used to calculate the summation of values that meet specified condition(s).

    In FineBI, you can also perform conditional summation and counting using function combinations.

    iconNote:
    The solutions provided in this document do not support cross-table calculations and are limited to operations within a single data table.

    Conditional Count

    In Component

    iconNote:
    If you only want to count occurrences without deduplication, you can use the COUNT_AGG function for simple counting.

    For example, you can calculate the number of users who log in on the current day (duplicating data of telephone numbers for the users).

    Example data: User Retention Analysis.xlsx

    Procedure

    Create an analysis subject, upload the example data User Retention Analysis, click Save and Update, and then click Component in the lower left corner to enter the component editing page.


    Click the icon, select Calculation Field, name the field Number of Logged-in Users on the Activation Day, enter the formula COUNTD_AGG(IF(DATEDIF(The Earliest Activation Date,Login Date,"D")=0,Telephone Number,null)), and click OK, as shown in the following figure.


    The following table describes the formula in detail.

    Formula

    Description

    DATEDIF(The Earliest Activation Date,Login Date,"D")

    The formula is used to calculate the time difference between the login time and the earliest activation time, returning the difference in days.

    IF(DATEDIF(The Earliest Activation Date,Login Date,"D")=0,Telephone Number,null)

    If the time difference equals 0 (indicating login occurred on the same day as activation), the user's phone number is output. Otherwise, the value is excluded from counting.

    COUNTD_AGG(IF(DATEDIF(The Earliest Activation Date,Login Date,"D")=0,Telephone Number,null))

    The formula is used to perform distinct counting on telephone numbers of users who logged in on the same day.

    Effect Display

    Select a group table, drag the The Earliest Activation Date field to the Dimension bar, click the icon, and set its group to Year-Month. Drag the Number of Logged-in Users on the Activation Day field to the Indicator bar. In this way, the count of users who logged in on their activation date will be displayed, as shown in the following figure.


    iconNote:
    To count only non-empty values, you can use a formula similar to COUNTD_AGG(IF(Field1!= "", Field2, null).

    In Data

    You can use the Group Summary function to achieve deduplication counting and regular counting, as shown in the following figure.


    Conditional Count

    For example, you can calculate the total refund of Company 1 in Beijing.

    Example data: Regional Data Analysis.xlsx

    Procedure

    Click Component to enter the component editing page, click , set Field Name to Refund of Company A in Beijing, enter the formula SUM_AGG(IF(Province="Beijing"&&Customer="Company 8",Refund,0)), and click OK, as shown in the following figure.

    The following table describes the formula in detail.SUM_AGG(IF(Province="Beijing"&&Customer="Company   8",Refund,0))

    Formula

    Description

    IF(Province="Beijing"&&Customer="Company 8",Refund,0)

    If the province is Beijing and the customer is Company 8, the refund is turned.  Otherwise, 0 is returned.

    SUM_AGG(IF(Province="Beijing"&&Customer="Company   8",Refund,0))

    The formula is used to summarize the result returned by the above formula.

    Effect Display

    After you save the added field Refund of Company A in Beijing, drag the field into the Indicator bar. In this way, the refund in the specific conditions are displayed, as shown in the following figure.

    附件列表


    主题: System Management
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy