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.
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
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.
You can use the Group Summary function to achieve deduplication counting and regular counting, as shown in the following figure.
For example, you can calculate the total refund of Company 1 in Beijing.
Example data: Regional Data Analysis.xlsx
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))
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.
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.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy