Crystal Report SUM function with CASE

2020-05-07 05:47发布

I have the following column values in my crystal report:

|Code |Unit |
|A    |2    |
|B    |3    |
|C    |2    |
|D    |3    |
|E    |1    |
|F    |1    |
|G    |4    |
|H    |(3)  |

I want to summarize the Unit except the Units which has Code H,J,K, and L. The Codes: H,J,K, and L contains units which has parenthesis. Is there a way to do this?

2条回答
劫难
2楼-- · 2020-05-07 06:13

If you want to exclude any row or value from summary, it can be done by writing your case inside Use a formula field under Evaluate in Running Total Field

Refer the following Image...

Summary

The rows or fields which doesn't satisfy the condition will be skipped from Evaluation of summary.

Try this and get back with results !!

查看更多
甜甜的少女心
3楼-- · 2020-05-07 06:21

If you want to omit only units with ‘(‘ in it just convert this filed to number Use

Val ({Unit}) 

this will return 0 for non-numeric text and number for numeric create sum of these you will get what you want

If you want not to use any special then create formula field like this

if {fa_rep_vr_Main.CustomTitle} not in('A','B','C') then
    0
else
    val({Unit})

use sum of this

If you want sum of NewPriceAD then use it in mentained field

查看更多
登录 后发表回答