Count of All strings in a column broken by ;
Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=23032
Printed Date: 01 May 2025 at 8:31am
Topic: Count of All strings in a column broken by ;
Posted By: achandana01
Subject: Count of All strings in a column broken by ;
Date Posted: 19 Jan 2023 at 6:52am
Hi,
I need to do a total count of all Strings broken down by a ';' in a string, My data looks something like below
DATA:
EMP DEP
100 A;B;C
200 A; C
300 C
OUTPUT:
DEP COUNT(EMP)
A 2
B 1
C 3
I have put the following formula in the cross tab and do count on EMP however I am not getting the result I am looking for I know if else doesn't work the way I want
@Formula
if DEP like '*A*' then 'A'
if DEP like '*B*' then 'B'
if DEP like '*B*' then 'C'
Thanks
------------- chand
|
Replies:
Posted By: hilfy
Date Posted: 01 Feb 2023 at 9:58am
I wouldn't use a cross-tab for this - I don't think it's going to work to count a record more than once. If you don't have a lot of possible values for this field, you would create a formula for each possible value that looks like this:
{@A for Count}
If InStr({DEP}, 'A') > 1 then {EMP}
Then in the report footer, you would list each possible department with a count of its "for Count" formula to get your totals.
-Dell
------------- Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics
|
|