Try this expression: "ISNULL(Col1, 0) + ISNULL(Col2, 0)".
Datatable Expression Column Sum other column include Null Values
Hallo,
I have datatable with 3 columns with a datatype Long (Nullable) . Total colum is sum of other two columns in the datatable and i have a following expression set for the total column and it works only when other two column rows has value . if one of them does not have value then total is not shown. How can i correct it.
Column("Total"). expression = "Col1 + Col2"
Developer technologies VB
4 additional answers
Sort by: Most helpful
-
Hobbyist_programmer 621 Reputation points
2021-08-05T10:08:54.343+00:00 Hallo Viorel. It works but i dont want to see 0 when the sum is 0 i want to keep the total row empty if the sum is zero. tried Null, DBNull instead of 0 but not working.
-
Hobbyist_programmer 621 Reputation points
2021-08-05T11:14:48.577+00:00 hallo Viorel. I am getting this error Cannot convert value '' to Type: System.Int64.'
-
Hobbyist_programmer 621 Reputation points
2021-08-05T11:38:53.067+00:00 my data is something like this
i can change the column type in order to get the desired reult.
-
Hobbyist_programmer 621 Reputation points
2021-08-05T13:15:51.097+00:00 .Expression = IIF(ISNULL(Col1, 0) + ISNULL(Col2, 0) = 0, '', ISNULL(Col1, 0) + ISNULL(Col2, 0))"