## Resolved Problems with calculations in a table

1. Sergio Ciordia
2. Valentina Reports ADK
3. Monday, December 24 2018, 10:51 AM
Hi,

I have added a table to my report that summarizes the tax rates of my products (10 or 21%). I have 5 columns in the table with these calculations:

• Column-1: \$F(field1)
• Column-2: \$F(field2)
Column-3: = field1 * field2 / 100
Column-4: = field2 + (field1 * field2 / 100)
Column-5: = CASE field1 WHEN 10 THEN (field2*1,4/100) When 21 Then (field2*5,2/100) ELSE 0 END

If I include the first 4 columns (and their calculations), the table is shown and works perfectly but if I add the fifth column (conditional statement) it does not work.

I have two questions:

- How could I include the conditional statement correctly so that the table is shown and works?
- Could I replace the fields in the calculation of column-4 with the column values (column-2 + column-3)?. What would be the correct expression?.

I want to clarify that I can include the conditional statement in the SQL query and it works perfectly with CASE expression but I do not know how to add it directly to the table.

Thank you very much.

Best regards,
Sergio
Comment
Responses (6)
Sergey Pashkov Accepted Answer
Hello Sergio,

Is there any error message? What datasource is used?
Comment
1. more than a month ago
2. Valentina Reports ADK
3. # 1
Sergio Ciordia Accepted Answer
Hi Sergey,

The datasource is a SQLite query:

Select
IdInvoice,
(VAT * 100) AS field1,
SUM(Total_row) AS field2
FROM
Details_Invoice
WHERE IdInvoice = \$P(ParamIdInvoice)
GROUP BY field1

There are several error messages. I attach a screen-capture with these errors.

Thank you very much.

Sergio
Attachments (1)
Comment
1. more than a month ago
2. Valentina Reports ADK
3. # 2
Sergey Pashkov Accepted Answer
And what if you use the point as a decimal separator, 1.4 and 5.2?
Comment
1. more than a month ago
2. Valentina Reports ADK
3. # 3
Sergio Ciordia Accepted Answer
Ouhhhh!! It has been a very silly mistake. I get all the decimal values with a comma and I thought I would have to write the conditional expression with that separator symbol.

What do you think about the calculation of column-4? Would it be possible to use the previous column values?.

Thank you very much Sergey.

Sergio
Comment
1. more than a month ago
2. Valentina Reports ADK
3. # 4
Sergey Pashkov Accepted Answer
No, it's not possible to reference other columns
Comment
1. more than a month ago
2. Valentina Reports ADK
3. # 5
Ok, thank you very much.

Best regards,
Sergio
Comment