Distinct Count of Multiple Columns
Printed From: Crystal Reports Book — Forum Name: Technical Questions
Posted By: cbaldwin — 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
Posted By: DBlank — 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?
Posted By: cbaldwin — 1 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.
Posted By: DBlank — 1 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.
Posted By: cbaldwin — 1 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
|