Conditional summation in Crystal Reports

青春壹個敷衍的年華 提交于 2019-11-30 19:39:34

问题


I have some rows with a price and quantity and I'm looking to sum only the prices where the quantity > 5

itemname        price         Qty
----------------------------------
apple            20            2
watermelon       10            3
bango            22            6
hashesh           3            9

Given the above data, the sum I'd like to get is 22+3=25. How do I write a formula to do this?


回答1:


create a formula field named calculation to the side of quantity and enter the following text:

// {@calculation}
If quantity>5 then price
else 0

now take the sum of {@calculation}. suppress both detail in the report.

Take the sum and place in the footer of the required column.



来源:https://stackoverflow.com/questions/22483434/conditional-summation-in-crystal-reports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!