Use Variance for Distinct Count of Group Results

Post Author: Judith
CA Forum: Crystal Reports
Hi there,
I am new to CR. I am using CR 2008. I am stuck (every two minutes) and it would be great, if you could help me with this one:
I have a list of people who are talking to each other:A to B, B to A, C to D, D to A etc. Then I wanted to see, who has most friends and I have created Groups to have a Distinct Count on how many people are talking to A, and to B, and to C etc. that worked fine. What I would like to do is to find out is who of these has most people they are talking to. Or even better, what is the variance of the resulting subtotals. Simply using Variance or Maximum doesn't seem to work on the DistinctCount Summary.
I would very much appreciate any help on this.
Judith

Post Author: Jagan
CA Forum: Crystal Reports
I understand the issue, I don't understand why you think DistinctCount at two different levels should total up. Consider this sample data:Facility, EmployeeA, 1A, 2B, 1B, 3
Facility A's distinct count => 2Facility B's distinct count => 2Report's distinct count => 3
Use DistinctCount() at the group level and create a formula to sum these counts yourself and print that in the report footer.

Similar Messages

  • Error: The sort order specified for distinct count records is incorrect

    When processing a measure group with a distinct count measure in it, i get the following error:
    "The sort order specified for distinct count records is incorrect."
    I have no idea what this means - any ideas?

    I had the same problem and your fix worked.  In more detail, the problematic field was contract_no.  I added a named calculation to the table in the Data Source View with the formula CHECKSUM(contract_no).  Then I created the distinct count measure on that named calculation.  And, lo and behold, the errors disappeared! 
    Thank you to Frank.
     - CindyCindy P Hoskey

  • Distinct count of Group header

    Hi Experts ,
    I have a crystal report where i have grouped on Business area and group header carries YTD Actuals Vs Target
    and in detail section  it carries  in different regions information ofthe business area.
    Now my concern is i need to count distinct business area in report header based YTD Actuals <= or > Target.
    Any Ideas!!!
    Thanks,
    Krishna

    I am not sure if I am understanding what you are asking correctly, but here is my take on it.
    You have a group that is identified as "Business Area"
    You have done a calculation to determine the YTD Actual for each Business Area which you have put into the Group footer or header
    Now you want at the report level a count of the business areas that have YTD actuals <= the Target, and a count of the business areas that have YTD actuals > the Target.
    If this is correct, could you use a running total?  In your field explorer pain, right click on Running Total and select New to open up the running total editor. In the summary section, select field to summarize on the field you used to define a business area; type of summary is "distinct count'; in the evaluate section, set up a formula to look for the YTD Actual <= to whatever the target was supposed to be; in the reset section, select never. 
    If this is not what you are trying to do, could you please reword your question?  For example, are you trying to reshow each business areas YTD totals compared to the target in your report header instead of a count?

  • Invalid values for negative counts using DAQmxReadCounterF64 for edge counting

    I am seeing this issue with using DAQmxReadCounterF64 with
    simple edge counting. If the counter reads a negative count value, it
    returns a number that looks like an unsigned 32-bit number rolled over
    (~4294967295).
    I am using DAQmx v8.9.5. PXI-6602 with Windows XP, programming in C++.
    Is this a bug in the driver?

    Hi Mroche,
    You're correct that the number you are seeing is the rollover of an unsigned 32-bit integer.  Newer DAQ products use a 32-bit count register (e.g. M Series, TIO, X Series).  In this register, the value -1 is represented the same as 232-1. 
    I wouldn't call this a bug exactly.  The value you are reading is what is in the count register, and I don't think it makes sense to necessarily assume that 4294967295 should be scaled to -1 for all cases.  Making this assumption would result in undesired behavior for anybody trying to count to 231 or higher (at which point the count would roll over to -231).
    Having said that... position measurements are treated differently starting in DAQmx 9.0 due to the behavior reported on another thread which was in fact deemed a bug (which I notice you have seen already).  The driver casts the raw count to I32 before scaling it to a position.
    Now, I'm not so sure it makes sense to treat the two measurement types differently, but I think the reasoning behind the decision was that negative values make sense when talking about position, but for counting edges not quite as much (what exactly is a negative number of edges?).  In the count edges case, I think it makes the most sense for DAQmx to allow the user to handle rollovers himself.  At the end of the day, all the driver can do is change where the rollover occurs (either at 0 = 232 or 231 = -231).
    In your case, if you want to read (-) values on your count edges task, the easiest way to accomplish this is to read the data back as U32 (DAQmxReadCounterU32) then type cast it to I32.  This will give the result that I think you are looking for.
    If you have any suggestions to help improve usability, please feel free to post to the DAQ Idea Exchange.  Some preliminary ideas to make this experience a little more intuitive might include a property node to set how the data is cast, or perhaps have the driver cast the data to I32 if the Count Direction is set to anything other than Count Up.  Although, the 2nd idea has the potential to break existing applications so it might not be as viable of an option.
    Best Regards,
    John Passiak

  • It's been two years since Windows 7 64 bit computers came out. At what point is Firefox thinking of providing a browser that is compatible with this. I haven't used Firefox for 2 years as a results. And what exactly is Waterfox?

    If you do a search on the web, you will discover that I am far from the only one who finds that she cannot use Firefox because it is incompatible with Windows 7 64 bit. I'm pretty sure there must be hundreds of thousands of users out there that can not use Firefox for the same reason. At what point are you thinking of updating your browser?
    Also are you connected to Waterfox and is it safe?

    In device manager tick Show hidden devices, under view on the toolbar.
    If DM cannot see it you cannot install a driver, not sure why that hardware will not get detected.

  • Use of SUM and COUNT with GROUP BY

    All,
    I have a set like below:
    State DOB StartDt EndDt Desc Category MemberID SubID Code
    NC 2003-01-30 2014-01-01 2014-01-31 Child B 123456 2 38
    NC 2003-01-30 2014-01-01 2014-01-31 Child B 123456 2 39
    NC 2003-01-30 2014-02-01 2014-05-31 Child B 123456 2 38
    NC 2003-01-30 2014-02-01 2014-05-31 Child B 123456 2 39
    NC 2003-01-30 2014-06-01 2014-07-31 Child B 123456 2 38
    NC 2003-01-30 2014-06-01 2014-07-31 Child B 123456 2 39
    NC 2014-01-17 2014-01-01 2014-07-31 Infant S 456789 1 49
    NC 2014-02-04 2014-02-01 2014-07-31 Infant S 246376 3 49
    -- MemberID and SubID identify 1 member
    -- Member 123456 has 2 distinct "Code" i.e. 38,39 but each code has different "StartDt" and "EndDt"
    -- Expected Result
    State Desc Category CountOfDistinctCode TotalMonthsEnrolled
    NC Child B 2 (38 and 39 for same member) 7 months (1 + 4 + 2) (Difference between StartDt and EndDt:1 (1/31/2014 - 1/1/2014) + 4 (5/31/2014 - 2/1/2014).. )
    NC Infant S 2 (Same code 49 but different member) 13 months (7+6) (7/31/2014 - 1/1/2014 = 7 months + 7/31/2014 - 2/1/2014 = 6 months)
    I tried doing a count of distinct Code and the summing up the member months, grouped by State, Desc, Category, but I am not able to get 2 and 7 for child, it somehow calculates Months as 14 (7+7). Please let me know what you guys suggest.

    OK, so we need a different approach. We need a table of numbers, a concept that I discuss here:
    http://www.sommarskog.se/arrays-in-sql-2005.html#numbersasconcept
    (Only read down to the next header.)
    We join the numbers to temp table with BETWEEN over the numbers. Then we count the distinct combination of member ID and number.
    We also need to make an adjustment how to build the string for the DISTINCT. I initially assumed that your columns were integer, why I used str() which produces a right-adjusted fixed-length string of 10 characters. (The default, you can specify a different
    width as the second parameter.) But str() expects a float value as input, and will fail if for instance member id would be non-numeric. We cannot just concatenate the strings, since in that case (MemberID, SubID) = ('12345', '61') would be
    the same as ('123456', '1'). So we must convert to char to get fixed length. All that said, and some more test data added, here is a solution:
    CREATE TABLE #Test
    [State] CHAR(2),
    DOB DATE,
    StartDt DATE,
    EndDt DATE,
    [Desc] VARCHAR(8),
    Category CHAR(1),
    MemberID VARCHAR(10),
    SubID VARCHAR(2),
    Code VARCHAR(5)
    INSERT INTO #Test
    VALUES
    ('NC', '20130130', '20140101', '20140120', 'Child', 'B', '123456', '2', '38'),
    ('NC', '20130130', '20140121', '20140131', 'Child', 'B', '123456', '2', '39'),
    ('NC', '20130130', '20140201', '20140531', 'Child', 'B', '123456', '2', '38'),
    ('NC', '20130130', '20140401', '20140613', 'Child', 'B', '123456', '2', '39'),
    ('NC', '20130130', '20140601', '20140731', 'Child', 'B', '123456', '2', '38'),
    ('NC', '20130130', '20140614', '20140731', 'Child', 'B', '123456', '2', '39'),
    ('NC', '20130129', '20140601', '20140731', 'Child', 'B', '9123456', '1', '38'),
    ('NC', '20130129', '20140614', '20140831', 'Child', 'B', '9123456', '1', '39'),
    ('NC', '20140117', '20140101', '20140731', 'Infant', 'S', '456789', '1', '49'),
    ('NC', '20140204', '20140201', '20140731', 'Infant', 'S', '246376', '3', '49')
    SELECT * FROM #Test ORDER BY MemberID, StartDt, EndDt
    SELECT
    [State]
    , [Desc]
    , Category
    , COUNT(DISTINCT convert(char(10), MemberID) +
    convert(char(2), SubID) +
    convert(char(5), Code)) AS TotalCnt
    , COUNT(DISTINCT convert(char(10), MemberID) +
    convert(char(2), SubID) +
    str(N.Number)) AS CalMonths
    FROM #Test t
    JOIN Numbers N ON N.Number BETWEEN
    datediff(MONTH, '19000101', t.StartDt) AND
    datediff(MONTH, '19000101', t.EndDt)
    GROUP BY [State], [Desc], Category
    go
    DROP TABLE #Test
    Erland Sommarskog, SQL Server MVP, [email protected]

  • First time scheduling using IP30 for Multiple Counter plan

    Hi,
    I created a multiple counter plan with Cycle set as 6months/ 300 Operations.
    I intend to start the job early and updated the Planned Counter date as  1st Sep 2014.I maintained Lead Float as 10 days.
    When I run IP10, call is generated successfully. But when I execute IP30, no call is generated.
    We have not activated enhanced functionality of Multiple Counter plans.
    I checked all the parameters and everything seemd to be fine. In IP30, I checked the check boxes - Rescheduling & Immediate start of all.
    In the field, Interval for Call Objects, I ran with blank value, 30 days value. But in both the cases, call is not generated.
    I want to generate calls using IP30 only as there are lot of multiple counter plans. Can anybody suggest a solution to this issue?

    Hello
    As you intended to use cycle set functionality please activate enhanced functionality of Multiple Counter plans
    Br
    Rakesh

  • Distinct Count Function-how to use properly

    Hello,
    I am new to using forums & have only been using Crystal since May of 2009, so i hope i do this correctly & provide the appropriate information.  i've looked for this answer in what's been posted but cannot find it.  Some things i've read I don't really understand.  I only know how to use the functions that are in the software, i don't know how to write them myself (i think that's when people have referred to SQL code or basic syntax)
    I have CR Professional, version 11.0.0.1282 (Crystal Reports XI).
    I work at a county health dept and we have a annual medicaid cost report,  I am linking Crystal to our EMR billing module.  i have my report sorted by insurance, ie medicaid, bcbs, abw, hpm etc.  and within each ins group i have the clients ID, DOS (date of service), procedure code, charge amt, ins pmt & patient pmt.  i have totaled the charges & pmts for each group-works fine.  i even have been able to create the formula to adj out the duplicate entries in the billing module (a service was entered wrong then adjusted out then re-entered correctly-without my formula crystal was pulling both these records and adding them to total charges.)
    Where my problem lies and what my question is:  I need to count encounters, an encounter is the visit, but each visit could have 2 or more procedure codes.   So this results in multiple lines on my report for one visit, which i want for the charges to add correctly, but it makes my visit count to high. So I read about the distinct count function, of which there are three listed & i'm having a hard time understanding the differences.  What i tried is: a distinct count of the acct ID-so the same acct ID's are only counted the one time.  But some clients see us more than once per year, meaning the acct ID is the same but the DOS is different.  For this client that would be 2 visits.  But crystal is counting this as 1.
    Saying what i want to do is this:  Count as 1 when the acct ID and DOS are the same.  I've tried using the different distinct counts but when i check my formula it always has errors.  So I'm sure my lack of knowledge is what's holding me up-i fully believe crystal can do this.
    Any help would be greatly appreciated.

    I create a dummy table, set up acc_id and DOS and Charge.
    Created a running total
    Summarized acc_id
    Type of summary Count
    Evaluated using a formula
         <> previous ()
    and reset on ACC_ID
    My groups were sorted by acc_id and date
    where there were multiple visits on the same DOS my count was 0
    where the dos changed it would count accordingly.
    You may need to use two Running totals to get the complete picture.

  • Running Total & Distinct Count Query

    Crystal 10.0.0.533 CR Professional
    Hope you can assist.
    I have a report listing deals signed, each deal has a corresponding category i.e. industry type, Accountant, Chiropractor, Financial Services, etc.
    I am undertaking a Distinct Count on these categories so that in the group footer it is showing number of different categories signed in a period (the report is grouped into different date periods). This is working OK.
    However, I need to EXCLUDE the category from this distinct count if the deal value is zero.
    I have tried using a formula to show a blank field if the value is zero, however it appears to be distinctly counting the blank as a category?
    Any assistance would be much appreciated.
    Tracy

    Deffinetly it will be less than what you expect for grand total. It is because when you are calculating distinct count for each group suppose
    Group A has categories A,B,C,D-->distinct count (4)
    Group B has C,D,E,F-->distinct count (4)
    but while calculating grand total then the distinct count will be
    A,B,C,D,E,F --> grand total (6) but not (8).
    In this case you need to use mannual running total like this
    whileprintingrecords;
    numbervar i;
    i:=i+{running total};
    place this in group footer and create another fomula like this
    whileprintingrecords;
    numbervar i;
    place this in report footer to get the correct grand total.
    Regards,
    Raghavendra

  • MSSQL2005 Analysis Service Distinct Count

    hi,
    i am currently trying to build a distinct count on my cube (mssql2005 analysis services).
    But after i added the discount count on the field i want to and start the processing, the following errors appear.
    - Errors in the OLAP storage engine: The sort order specified for distinct count records is incorrect.
    - Errors in the OLAP storage engine: An error occurred while processing the 'FACT VIEW STATISTIC' partition of the 'FACT VIEW  STATISTIC 1' measure group for the 'Accident Statistic' cube from the OLAP_PROJECT database.
    the count measure works fine.
    will appreciate any help on this distinct count problem.
    thanks in advance.
    HY

    I also received this error:
    "Errors in the OLAP storage engine: The sort order specified for distinct count records is incorrect. "
    Running SQL Server 2005 SP2 Enterprise Edition
    The collation between SQL Server and Analysis Services was the same.
    The distinct count was on a character data type.
    There were no NULLs in the data.
    The cube was processing fine until new data was added.
    After some investigation into the data it seems that the culprit was one row that the data length was 13 characters on the column of the distinct count. Everything else was less than 13 characters. (See results below). Updating this one row solved the problem. The exact value of the data is: '1-4296-175-9'
    Here is a result set:
    select len(columnname) as data_length, count(*) as count
    from [tablename]
    group by len(columnname)
    order by data_length
    data_length   count
    2    3
    5    1
    6    3
    7    2
    9    1
    10    856
    13    1
    My question though is if SQL2005 can do distinct counts on strings then why choke on one row with an extra length?

  • Distinct Count in Explorer

    This is from BOB post, which was posted in 2008. Now it's 2013 and there is no solution by SAP? We are doing a POC on Explorer, this is probably time to scrap it. Very frustrating! Is there any
    Hi,
    We have 2 tables used in universe "orders" and
    "order_line_product_item" from where we are pulling data in explorer indexes.
    We have issues getting distinct count of
    customers in explorer when we bring data from order line product item level
    facets/dimension.
    Just wondering if anyone else had solution of how to
    handle this on explorer side?
    At universe level we using count (distinct cust key), which is working at
    webintelligence.
    Looks like BO XI R3 further enhanced on handling this kind
    of situation by implementing delegated measures, but don't find anything similar
    to it in BO explorer.
    Occurrences is always getting us count at the lowest grain level(basically row level
    counts, but we are looking for distinct counts though !) .
    Is getting
    distinct counts limitation in explorer?
    Any help will be greatly
    appreciated.
    Thanks,
    ~SK
    Courtesy of Sachin

    Hello,
    So if you have a calculation(Webi) function(Excel) built into the two tables you are using from the data source you might try 'configuring' the data as 'Occurance' from the workspace you created or after the file in index if you're using excel.  If you are using a universe as a data source for the exploration view set you can attempt to drag the 'measure' needed (count) into the workspace option "measure" when creating the workspace.
    I do hope this helps

  • DAX query to calculate distinct count respect to a column after a Filter function - SSAS 2012 Tabular

    Hi,
    I'm trying to build the dax query to determine the distinct count for a column returned by the application of a Filter function.
    evaluate(
    row("counter",
    countrows(
    filter(order_summary,
    year(order_summary[change_date]) = 2013) )
    I need to count the distinct values for an id returned by the Filter function.
    Any helps, please? Thanks

    Hi pscorca,
    According to your description, you want to calculate the distinct values for records where change_date is 2013. Right?
    In this scenario, we can use the DISTINCT() function within COUNTROWS(). Please try the expression below:
    =calculate(
    countrows(distinct(order_summary[column])),
    Filter('order_summary', year(order_summary[change_date])=2013)
    Reference:
    Distinct Count Measure in PowerPivot using DAX
    Related Distinct Count
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Add new batch during count entry (for cycle count by quant LICC)

    Hi! We are using LICC for cycle counting by quant as we have mixed storage and do not want to count all the materials in a single bin. Most of the materials involved are batch-managed. One issue we have is we may discover other batches during stock take. In this case, how can we add this to the stock adjustment since we cannot add new item when we use cycle counting by quant?
    Appreciate your suggestion in this case.
    Cheers!
    SF

    Hi,
    Whenever you find discrappancies, in this case founds, you will note these down and first do an analysis whether this particular batch has been written off in the past as lost. When not, you will make a MB1À or MIGO booking to add this found batch to stock. When yes, you could do a reversal of the issue or do a new receipt.
    MdZ

  • Default VAT 4 % for 1 particular material group

    My client wants to default VAT 4 % for 1 particular material group...It means if i create PO for that particular material belonging to that material group  it should fetch VAT  4 % default.
    How to map it?

    Hi,
    For the VAT condition type, maintain access sequence with the field material group and then create the tax condtion using FV11 for the said material group with 4% tax rate. All subseqent PO's created with that particular Material Group will automatically calculate VAT with 4% based on the conditon record, Pl check
    Regards
    Merwyn

  • Variance on a Group Results from DistinctCount

    Post Author: Judith
    CA Forum: Formula
    Hi again,
    I will just write down all my questions and probably someboday has mercy on me :-D
    Here is another one:
    I have two tables that show who is talking to who
    A to B, B to C, C to A, B to A etc.. I have grouped them to see who is talking to who (B to A, B to C). Then I have done a Distinct Count to see who has most connections. So far so good.
    But now I would like to take all the DistinctCount subtotals and find the Maximum or the Variance of them. I get an error message that DistinctCount results can't get further summarized. How do I do that?
    Cheers,
    Judith
    PS. I posted that somewhere else in this forum as well as I am not sure, yet, where the most successful place is. So: sorry if you stumble over this again.

    Post Author: V361
    CA Forum: Formula
    Hi Judith,   Look into Shared Variables,   here is an example.
    Summing a Shared variable
    Use another variable to sum it.Numbervar Summ;shared Numbervar FromSub;Summ := Summ+FromSubCreate a second group footer, suppress it, and put this formula in it.
    Create a formula in basic syntax for this.
    Add it to the report and create a summary- maximum.
    Cut it from the report footer and insert into the header to see a list of all distinct cost codes listed in the report.
    Global Cost_Code_Place_Holder as string
    Global Final_Output as string
    If Cost_Code_Place_Holder <> {activity_record.cost_code} then
    If instr(Final_Output,{activity_record.cost_code})=0 then
    Cost_Code_Place_Holder = {activity_record.cost_code}
    Final_Output = trim(Final_Output) & chr(13) & trim(Cost_Code_Place_Holder)
    End If
    End if
    Formula = mid(Final_Output,2,len(Final_Output))

Maybe you are looking for

  • How to tell if video card works at 8x speed on MS-6570 K7N2-ILSR?

    my mobo is MS-6570 K7N2-ILSR with the latest bios update and my video card is ATI READON 9600 236mb 8x agp and windows xp pro sp2. when installing ATI Catalist v5.9 (the latest), it configures the card at agp speed: OFF. in the bios, all i have for a

  • Superscript shortcut no longer working

    Initially the shortcut for superscript worked but, it is no longer working.  I have to use format/font/baseline/superscript to turn on and off.  A real pain without the shortcut. During one of my Pages classes the instructor added the character map t

  • I use Aperture 3 how can I have the tool bar colored?

    I use Aperture 3, how can I have the tool bar colored?

  • Movie artwork won't display in home share on iPhone

    I just finished encoding a bunch of my movies and using MetaX to quickly add all the meta tags (most specifically the artwork). I imported these movies to iTunes and everything has been great. Again, most importantly, the art work was showing on my i

  • Stopping PO creation using Status profile

    Hi, We are using status profile to release orders.In the case of third party item, we need to stop po creation.Even though i forbidd PO generation in status profile, po is generating for third party items.How to solve this issue?