Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Total Count of String fields

Dear all,

I am creating a new report which should include a total number of Lenses grouped by gate numbers. However to calculate it, I have two String fields.

Stock Code 1

Stock Code 2

Now for counting them separately, I did not have any problems, I used

Count(StockCode1)

Count(StockCode2)

Example 1

gate No. ==== StockCode1====StockCode2
1            ====  456           ====  456
2            ====  758           ====  234
3            ====  800           ====  100

Now what I need is the combination of both. i.e (Count(StockCode1+StockCode2)).

Example 2

gate No. ==== StockCode1====StockCode2====TotalStockCode
1            ====  456           ====  456           ==== 912
2            ====  758           ====  234           ==== 992
3            ====  800           ====  100           ==== 900

What I am getting is a grand total number of StockCode1 and 2. For example I am getting 2804 in all rows of TotalStockCode.

So it looks like this

Example 3

gate No. ==== StockCode1====StockCode2====TotalStockCode
1            ====  456           ====  456           ==== 2804
2            ====  758           ====  234           ==== 2804
3            ====  800           ====  100           ==== 2804

What I need is the Total count of Stockcode1+2 individually and not grand total. Just like in my example 2 I need it to work like that.

Any ideas how to go about this?

Many thanks

Regards

Jehanzeb

Former Member
replied

hi Jehanzeb,

As you have mentioned,

- Stock Code 1 and Stock Code 2 are String fields.

- You have calculated the count of Stock Code 1 and Stock Code 2 individually and placed it in Group Header/Footer.

- The group is based on Gate No.

As I understand the query, you would like to calculate the sum(count(Stock Code 1)+Count(Stock Code 2)).

Let me know if I missed missed out anything.

Please try below formula and let me know if it works for you.

Count({TableName.Stock Code1}, {TableName.Gate No.}) + Count({TableName.Stock Code2}, {TableName.Gate No.})

Place above formula in Group Header/Footer.

Regards,

Alpana

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question