Articles in this section
Category / Section

How to handle null values in aggregated expressions

Published:

When creating expressions, it is common to encounter issues due to null values in the columns. To overcome this issue, you can handle a condition while creating SUM expressions for the columns containing null values.

Syntax

To handle null values in expressions, use the following syntax:

IF(SUM([Column name]) IS NULL, 0, SUM([Column name]))

Example

Consider the following sample expression:

IF(SUM([Balance]) IS NULL, 0, SUM([Balance])) + IF(SUM([Credited]) IS NULL, 0, SUM([Credited])) + IF(SUM([Income]) IS NULL, 0, SUM([Income]))

This expression applicable for all data sources except Microsoft SQL Server Analysis Services (SSAS).

This expression checks if the sum of each column is null. If it is, the expression returns 0; otherwise, it returns the sum of the column.

image.png

Output

The output of the expression will be the sum of the non-null values in the specified columns.

Related links

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
IJ
Written by Israel Jebaraj Chandirakumar
Updated
Comments (0)
Please  to leave a comment
Access denied
Access denied