Author: Eliza Leppik

Show all Blog
In today's article, we will discuss the functionality of data analysis utilizing the SumIf() and CountIf() functions within dashboards. These functions serve to either sum data field values or count the occurrences of values based on specific conditions. In this article, our focus will be on the application of these functions in the Table element. However, it's important to note that they are equally applicable in other dashboard elements where data analysis is performed. Before a comprehensive review, let's take a moment to refresh our understanding of how data field values are processed in dashboards.

Data analysis in dashboards

When a data column is introduced to an element (as in our case, a Table element), functions can be applied to the values within. By default, numeric values employ the sum function, while non-numeric values utilize the function for counting occurrences. This discussion pertains specifically to fields of the Measure type; Dimension fields lack predefined functions. Additionally, Measure field values are organized according to the values of Dimension type fields. In simpler terms, if categories constitute a Dimension field and products constitute a Measure, the products are grouped by category. Consequently, one of the functions - Sum, Count, Min, Max, Avg, or another—is then applied to the field containing the product list. Thus, the SumIf() and CountIf() functions find application in grouping solely those values that adhere to a specified condition.Important!

It is essential to note that these functions are not listed among the fundamental data field functions. However, you have the capability to manually specify them by altering the data field function.

Analysis by conditions

The condition for considering a value is passed as the second argument to the SumIf() and CountIf() functions. When the condition is set to true, the corresponding value is added to the sum, or the respective data row contributes to the total row count. On the other hand, if the condition yields false, the value is disregarded. Let's illustrate this concept with a few examples of conditional analysis.

  • Consider a scenario where the Table element contains a data field named "products," used for calculating the product count. In essence, the Count() function is employed for value computation. In such cases, data filtration can be achieved using the CountIf() function, wherein the condition is passed as the second argument.

    For instance: CountIf(Products.ProductName, Products.CategoryID == 1).

    Subsequently, the computation of quantity will encompass only those products associated with a category ID of 1.

  • Within the Table element, there exists a compilation of continents along with their corresponding populations. Additionally, the values within the population column undergo processing via the Sum() function. Consider a scenario wherein, during the summation of Europe's population, the population of the United Kingdom should be excluded. In this context, the SumIf function comes into play for the population column.

    Here, the condition is incorporated, with the second argument taking the form of SumIf(Statistics.Population, Statistics.Country != "United Kingdom").

    Consequently, the summation will encompass values from the population column where the associated Country is not equivalent to the United Kingdom.

Below is an illustrative example of a dashboard that employs the SumIf() and CountIf() functions. In this instance, the condition is contingent upon the variable "continent," and solely values corresponding to the chosen continent undergo processing. Within the Table element, for comparative purposes, duplicate columns featuring both summation and summation by condition functions are presented. Notably, the contrast becomes apparent in the cumulative totals displayed within the table.

This approach allows for data filtration within dashboard elements. It's important to note that filtering through functions exclusively affects a particular data field. Simultaneously, a filter applied to an element or a filter integrated into an element's data transformation pertains to all fields within that element.
By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.