Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Distinct Count of Multiple Columns Post Reply Post New Topic
Author Message
cbaldwin
Groupie
Groupie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 81
Quote cbaldwin Replybullet Topic: Distinct Count of Multiple Columns
    Posted: 30 May 2018 at 5:19am
I have a report that includes three different columns of data. The data in the column can be duplicate. I would like to figure out how to do a distinct count of the data in all three columns combined.

Example:

COL1     COL2     COL3
M123     M245     M123
M246     M316     M245

i WOULD LIKE MY DISTINCT COUNT OF DATA IN THE THREE COLUMNS TO EQUAL 4.

Any insight into this would be greatly appreciated.

Thanks in advance.
CJB
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 31 May 2018 at 8:50am
can you use a stored procedure or command to union the columns together and do a distinct count of that?
IP IP Logged
cbaldwin
Groupie
Groupie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 81
Quote cbaldwin Replybullet Posted: 01 Jun 2018 at 4:21am
might be possible. will have to ponder that idea. I do create command tables and perform unions on a regular basis.Thanks for the idea.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 01 Jun 2018 at 4:36am
the only other thing I can think of is to basically keep appending a variable with each value and then run another variable to see if the existing value is in the appended list. This is very resource heavy and runs into issues of partial matches.
If you are really just looking for the result you could add a command that does the calculation and only returns that one value. Could even be a subreport.
IP IP Logged
cbaldwin
Groupie
Groupie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 81
Quote cbaldwin Replybullet Posted: 01 Jun 2018 at 6:49am
i am going to try the command route and go for only one value. i just have to make sure and get all the appropriate stars aligned so i get the correct list in this separate command table. There is lots of other moving parts associated with this report besides those three columns. But i believe that i can do it.

thanks,
cjb
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.000 seconds.