当前位置: 动力学知识库 > 问答 > 编程问答 >

Count the fields not including the zero value of the fields in crystal reports

问题描述:

I'm using Crystal Reports 2008. I have an output like this:

 Customer Total Amount Jan Feb Mar Apr May

A 20000 1000 2000 5000 0 7000

B 15000 5000 7000 3000 0 0

C 18000 8000 5000 0 8000 0

D 5000 5000 0 0 0 0

How can I make count the fields from Jan to May without the zero field value? So the output will be like this:

 Customer Total Amount Jan Feb Mar Apr May Count

A 20000 1000 2000 5000 0 7000 4

B 15000 5000 7000 3000 0 0 3

C 18000 8000 5000 0 8000 0 3

D 5000 5000 0 0 0 0 1

Thanks..

网友答案:

Create a formula for your Count columns something like this

IF {table.Jan} <> 0 THEN 1 ELSE 0 +
IF {table.Feb} <> 0 THEN 1 ELSE 0 +
IF {table.Mar} <> 0 THEN 1 ELSE 0 +
IF {table.Apr} <> 0 THEN 1 ELSE 0 +
IF {table.May} <> 0 THEN 1 ELSE 0 
分享给朋友:
您可能感兴趣的文章:
随机阅读: