Distinct Formula - nuberVar

I have the following formula that pulls information from a sub report onto my main page (a summary page) .....this works fine except within these sub codes I have casenumbers, and some casenumbers appear in more than one SubCode. As a result I am trying to figure out how to change this formula to do this count but only to count these SubCodes if the casenumber is unique/distinct within this subset......
numberVar a1;
if
{PendingActions.SubCode}in [120,130,140,145,150,155,160,165,170,175,180,190,195,207,215]
  then a1 := 1

Thank you very much!!!!
I needed to change it slightly - the in part never worked, so just changed it to OR and it worked a treat!!
Thanks again!
global cases(1000) as number
global lastCase as number
if {PendingActions.SubCode} = 120 OR {PendingActions.SubCode} = 130 OR {PendingActions.SubCode} = 140 OR {PendingActions.SubCode} = 145 OR {PendingActions.SubCode} = 150 OR {PendingActions.SubCode} = 155 OR {PendingActions.SubCode} = 160 OR {PendingActions.SubCode} = 165 OR {PendingActions.SubCode} = 170 OR {PendingActions.SubCode} = 175 OR {PendingActions.SubCode} = 180 OR {PendingActions.SubCode} = 190 OR {PendingActions.SubCode} = 195 OR {PendingActions.SubCode} = 207 OR {PendingActions.SubCode} = 215 then
  if {PendingActions.CaseNo} in cases then
    formula = 0
  else
    lastCase = lastCase + 1
    cases(lastCase) = {PendingActions.CaseNo}
    formula = 1
  end if
else
  formula = 0
end if

Similar Messages

  • Count Distinct Formula

    <p>Hello Folks</p><p> </p><p>I would like to know if somebody can help me about the followingscenario:</p><p> </p><p>I have members whose informing all contracts on the database,they are children of the dimension Customers.</p><p>I also have an attribute dimension informing the contract typethat, refers to the Customer dimension.</p><p> </p><p>Model of the outline structure:</p><p> </p><p>-Customers (<i>Dimension - level 2</i>)</p><p>    -Customer_ID (<i>level 1</i>)</p><p>        -Contract_Number{<i>Contract_Type</i>} (<i>level 0</i>)</p><p> </p><p>I need to return a result informing all the contracts per typeof it.</p><p> </p><p>I try to do the following formula:</p><p> </p><p>@COUNT(SKIPMISSING,@RANGE("Quant",@CHILDREN("Customers"));</p><p>But it returned with error.</p><p> </p><p> </p><p>Thanks advanced,</p><p> </p><p>Wallace</p><p> </p><p> </p>

    I reach solve this problem using the following formula:@count(Skipmissing, @ATTRIBUTE("BI"));

  • How to use the distinct key in formula field in SAP Crystal Reports

    I want to use the distinct key in formula field in SAP Crystal reports.
    When i'm using it shows an error.
    Please suggest me....

    Hi,
    Use DistinctCount keyword directly for your calculation instead of count(distinct(....
    Alternatively, if you want to avoid duplicate records, under "File" > "Report Options" make the 'Select Distinct Records' as True.
    Thanks,
    Raghavendra

  • Extracting a distinct list of values using the Index formula

    In Xcelsius, I am trying to retrieve a distinct list of values from data imported using the Reporting Services button.
    In the spreadsheet I am using the following formula:
    =INDEX($A2:$A831,MATCH(0,COUNTIF($B$2:B2,$A2:$A831),0))
    The above formula works correctly in Xcelsius, but when I select the preview button the values change to #N/A.
    Please could you advise on why this does not work?
    Many thanks,
    Natalie

    Hi Natalie,
    First, you have to be aware of the fact that Xcelsius "simulates" an Excel function. When you are in design mode, the actual "Excel" (MS code) functions are executed. But when you are in preview mode (or export to a swf), all Excel functions are simulated (Xcelsius code).
    The fact that your function works in design mode but not in preview/export may point to a bug.
    But there are also certain assumptions (to address speed/efficiency) on the Xcelsius code which may cause the preview to fail. One such assumption is that on the VLOOKUP function, Xcelsius does not recalculate formulas in the index column of the VLOOKUP table array - if the index column contains formulas, the index column will always remain in the initial state (will not dynamically recalculate).
    Also, not all features on a supported Excel function works. For example, array formulas are not supported.
    Bobby

  • Distinct records with conditional select formula

    Post Author: nelsonchris
    CA Forum: Data Connectivity and SQL
    Hello,
    I have a simple report pulling data from two tables. I want
    only distinct records. I am selecting records based on
    parameters; here is the select formula:
    ({?Service Name} = "*" or {selsvc.ServiceName} like
    {?Service Name})and
    ({?Program Name} = "*" or {selsvc.Selected Service Entry 
    Program Name} like {?Program Name}) and
    ({?Agency Name}  = "*" or {selsvc.Selected Service Entry 
    Agency Name} like {?Agency Name})
    The problem comes from the fact that Crystal will add the
    selsvc fields to the reports SQL select code, which has the
    effect of duplicating some records that do not have the same
    values for the selsvc fields. The select formula above is
    the only place in the report where values from the selsvc
    field are used, and as you can see they are only used when
    the user has submitted a matching parameter for them. I can
    not figure out how to get rid of the duplicates, please
    help!
    Thanks for your time,
    Chris

    Post Author: yangster
    CA Forum: Data Connectivity and SQL
    I don't follow why you are getting duplicates with your selectionare you getting duplicates without the selection criteria?if you are then they really are not duplicates and there could be issues with your joins between the 2 tables

  • Formula help - Distinct Count with 3 conditions

    I have a field named ID
    I need to Dcount records where Dorder = 1,0 or null
    I'm gonna need to perform similiar totals on other fields so I don't think I can use Record Select Expert (Is that right?)
    Thanks
    Steve

    Steve,
    Do a search in CR's online help for DistinctCount. It should have what you are looking for.
    Basically you'l want something like this...
    DistinctCount({TableName.FieldToCount}, {TableName.Order} = 1)
    DistinctCount({TableName.FieldToCount}, {TableName.Order} = 0)
    DistinctCount({TableName.FieldToCount}, IsNull({TableName.Order}))
    HTH,
    Jason

  • Distinct count of GRN's in Query PLD

    hi all,
    We have developed a daily grn report and designed report
    using  Query PLD.
    Report contains
    (grn no,date,vendor name,vendor ref no,item code,item
    description,quanity & line total)
    We want to display no of grn's(distinct count)
    @ repetitive area footer.
    Is there any function available in formula field to display
    distinct count of no. of grn's ? / It should done thru query.
    Thanks,
    with regards,
    A.Jeyakanthan

    it will be hard from PLD, instead u can have ur query like,
    SELECT 'Details', '   ',T0.Docnum, T0.CardName, .... FROM OPDN T0 WHERE Month( T0.DocDate ) = Month ('{%0]')
    Union
    SELECT 'Counts', count(T0.DocNum) as 'Doc(s) No', ' ', ' ', ... FROM OPDN T0 WHERE Month( T0.DocDate ) = Month ('{%0]')
    (Replace { with [ )
    Note ' ' is a gap in order to fill the other fields. in first query have given tht '  ' gap purposely so tht the display will not affect ur designing part
    union is used b'coz Count() fn is like aggregate, so wont allow further individual fields coming along with it.
    the 2nd query will occupy only one row, which by grouping u can separate and can hide from repetitive and take the value via formula field by writing that field's id to it into Footer Area.
    Regards,
    Dhana.
    Edited by: Dhanalakshmi C on Mar 5, 2008 1:31 PM

  • USE of PREVIOUS command to eliminate duplicate records in counter formula

    i'm trying to create a counter formula to count the number of documents paid over 30 days.  to do this i have to subtract the InvDate from the PayDate.   and then create a counter based on this value.  if {days to pay} is greater than 30 then 1 else 0.
    then sum the {days to pay} field to each group.   groups are company, month, and supplier.
    becuase invoices can have multiple payments and payments can have multiple invoices. there is no way around having duplicate records for the field. 
    so my counter is distorted by by the duplicate records and my percentage of payments over 30 days formula will not be accurate do to these duplicates.
    I've tried Distinct Count based on this formula  if {days to pay} is greater than 30 then . and it works except that is counts 0.00 has a distinct records so my total is off 1 for summaries with a record that (days to pay} is less than or equal to 30.
    if i subract 1 from the formula then it will be inaccurate for summaries with no records over 30 days.
    so i'm come to this.
    if Previous() do not equal
    then
      if {day to days} greater than 30
      then 1
      else 0.00
    else 0.00
    but it doesn't work.  i've sorted the detail section by
    does anyone have any knowledge or success using the PREVIOUS command in a report?
    Edited by: Fred Ebbett on Feb 11, 2010 5:41 PM

    So, you have to include all data and not just use the selection criteria 'PayDate-InvDate>30'?
    You will need to create a running total on the RPDOC ID, one for each section you need to show a count for, evaluating for your >30 day formula. 
    I don't understand why you're telling the formula to return 0.00 in your if statement.
    In order to get percentages you'll need to use the distinct count (possibly running totals again but this time no formula). Then in each section you'd need a formula that divides the two running totals.
    I may not have my head around the concept since you stated "invoices can have multiple payments and payments can have multiple invoices".  So, invoice A can have payments 1, 2 and 3.  And Payment 4 can be associated with invoice B and C?  Ugh.  Still though, you're evaluating every row of data.  If you're focus is the invoices that took longer than 30 days to be paid...I'd group on the invoice number, put the "if 'PayDate-InvDate>30' then 1 else 0" formula in the detail, do a sum on it in the group footer and base my running total on the sum being >0 to do a distinct count of invoices.
    Hope this points you in the right direction.
    Eric

  • Need distinct rows in BO XiR3 Webi report

    I have a report which is similar to below example. Report has multiple other columns like Issue owner, created date, target date etc which are different (means data doesnt repeat in any row and all are dimensions)
    1. User wants one single row for each ID. How to achieve this in BO Webi XiR3?
    ID
    Issue
    Severity
    1
    1.1
    High
    1
    1.2
    High
    2
    2.1
    High
    2
    2.2
    Medium
    2
    2.3
    Low
    3
    3.1
    High
    3
    3.2
    Medium
    3
    3.3
    Medium
    2. Above table is a detail tab. There is also summary tab which is as below. Requirement is that Count for High, Medium and Low in Summar tab should match with the count in detail tab and also should match with the row count in detail tab. This means only when ID column is unique, it will match with row count
    Original Target Dt
    Current Target Date
    Primary Owner
    High
    Medium
    Low
    Total
    1-Jan
    15-Jan
    A
    4
    3
    7
    14
    30-Jan
    14-Feb
    B
    6
    2
    0
    8
    24-Feb
    17-Mar
    C
    5
    6
    7
    18
    Total:
    15
    11
    14
    40
    Please help me to achieve the above target in BO report

    1)
    Please Check Universe Parameter .
    It Should Be Distinct .
    If It is Distinct Then In Web Trim all objects using formula.
    If ID is your granular level it should bring unique row for it ,
    For Unique row your  [ID] should be granular level .But in your image [Issue] is granular level .
    So you can do one thing apply Group on ID & Show Sum of Your KPIs in footer
    with specific color code for group total row.
    2)
    in Summary part
    Create Crosstab
    [Sevirity]
    Total
    [Original Target Dt]
    [Current Target]
    [Primary Date]
    { Count([ID / Issue] ) }
    Sum(use  Count)

  • PLEASE HELP: PDF Forms, creating average formula for text?

    Hello,
    I really hope somone can help. I cannot find any answers to my questions on the internet, google etc.
    First time using Acrobat. Im pretty quick learning on compters however the formulas my boss has asked me to do I have no idea if they are possible.
    We have a report form for exams and each section I need to calculate the average mark for that section.
    There are 3 questions for the first section. There are dropdowns for distinction, Merit, Pass and Below pass to select for each questions.
    Please see picture attached to show you what I mean.
    I want to be able to calculate the most selected/average dropdowns selected and not count the N/A's into award1 field?
    The fields must be text and cannot be numbers.
    so for example, track 1 got a distinction, track 2 got a Merit, Track 3 got a distiction. all other fields left n/a
    is there anyway to do this also is there any way to exactly the same as above as check boxes? - please see picture attached
    I appriciate any help. I am working on a mac
    Thanks
    Lauren

    Thank you so much reply
    Yes on the dropdowns the distincion, merit, pass or below pass values are in the correct areas ready for selection. For example on the distiction row you can only drop down for distinction and so on for Merit row dropdowns etc
    Check box is the way I rather do it as its quicker, however I created the dropdown option just incase check boxes average was not possible
    On the check boxes if i select merit for rtack 1 I would just tick the box and leave the the rest of the colum blank with no ticks. So just by seeing the tick I know its in the merit section for Track 1. However I donts know if I can do an average formula for with check boxes.
    If I check boxed/slected distinction for track 1, distnction for track 2 and merit for track 3 (obvisley any box could be ticked depeneding how the exam went so need then all in the script). I would like it to then calculate the avergae mark which would be distinction in the award1 field. While the none ticked boxes or N/A fields not affecting the average.
    This is just the start to a huge form Im doing Im dreading the rest of formulas I have to do lol
    sorry if im confusing you

  • Running totals: Custom Reset via Formula? (VS 2005)

    Post Author: PunchngMrGrumpy
    CA Forum: .NET
    Hi All,I have attached a screenshot to help make up for my inability to describe the situation I'm dealing with here.I
    have three groups within a report that currently use distinct Running
    Totals fields that Reset at the group levels that I assigned. I am
    attempting to create a single Running Totals field for all 3 groups
    that will reset depending on which Group is being calculated at the
    moment so that I don't have to have 3 separate Running Totals object
    for each and every group. I'm not sure how to do this or write this
    formula as I'm new to Crystal Reports and am used to SQL Reporting
    Services where this evaluation is automatically done for you (I was
    spoiled I guess).For example, if the Running Totals field
    control is in Group #1, I want it to reset at Group #1, and Group#2 to
    reset at Group #2, etc without having to create a field for each group.So
    basically I'm attempting to use a formula to create a Reset point (view
    screenshot for detail) that is determined by which group the data is
    being calculated in. Is this possible? I realize that it is possible by
    simply creating a new running total object for each group and telling
    it to reset on change of group specified, but this seems completely
    redundant and overly time consuming for larger reports where there are
    multiple groups and a lot of Running totals fields.I'm developing the report with Crystal Reports within Visual Studio 2005 if that helps any.I
    don't know if you'll be able to see it, but I have a screenshot link to
    explain what I'm trying to do. http://www.codeguru.com/forum/attachment.php?attachmentid=19302Thanks!

    Hi Abhilash,
    Thanks for the code, but the totals aren't right still yet.
    Also, I just noticed my running total is not functioning properly.  Count be the reason for my delima.
    Any suggestions on how to get the running total to function properly?
    What I just noticed is:
    Date               Patient          Count
    7/9/13             Patient A       7
    8/8/13             Patient B       8
    8/8/13             Patient B       8
    8/8/13             Patient C       8
    8/8/13             Patient D       8
    8/15/13           Patient E       9
    Would I be better off to do a formula vs a running total?

  • How do I solve this distinct count problem?

    Hello experts,
      So, I have an OBI report (table view).  I needed to get the percentage difference btn 2 columns, I did. Then I had to summarize difference in 4 buckets (0-15, 16-30, 31-50, >50%); I did (case statement). NOW,  I need to summarize(distinct count) the above buckets based on Store numbers for each day.
    Basically, if the difference is btn(0-5%) and I have 5 stores then I need to see 5 stores separately. The problem I am having when I do the distinct count instead of having separate counts for each bucket I am getting the total.  I see the buckets summarized, but the store column is showing the total number of all(we have about 700 stores) instead of breaking down the count for each bucket.  In the stores column I am using the distinct count function, I don't know if the problem is here or the case statement for buckets. I don't know either OBIEE is able to do what I trying to do, since I have yet to do this kind of function.  I have gotten few leads on my first post,  so far none of them have worked.
    As always, your insights are highly appreciated,

    Instead of using Distinct Count in Aggregation Rule,Try using in Column Formula.
    Let me know if u need any help on this.
    Thanks,

  • 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

  • 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.

  • Distinct count on date/time field...

    Hi,
    I am trying to a distinct count on this formula that takes a date/time field and converts it to a date in order to get a distinct count of dates.  However, it's not working... say, if I have two dates are the same (the times may be different), it's counted twice.  Any suggestions?  I tried to convert this to a string thinking the evaluation may change, but no dice.  Thanks!!
    if not isnull({AVAILABILITY.PAT_ENC_CSN_ID}) then
        cstr(cdate({AVAILABILITY.SLOT_BEGIN_TIME}))
    else

    You can use the following formula...
    DateAdd("d", DateDiff("d", #1/1/1900#, {TableName.YourDateTimeField}), #1/1/1900#)
    This will set each date value to 12:00 am of it's respective day...
    So 8/16/2010   3:01:20PM would become 8/16/2010  12:00:00AM
    Now you can group on this formula field and then simply do a count on the date at the appropriate group level.
    HTH,
    Jason

Maybe you are looking for

  • Shipping date information is shown on some devices, while not shown on others. What is the criteria?

    Hello all, Thanks again for taking the time to read this. I have a customer who considers the shipping date very important in their operations. Our HTOM was taking a look at the reports from the IR portal, and informed me that some devices showed the

  • Numlock on-screen indicator no longer appears

    Thinkpad W500, Windows 7 x64 SP1 with all latest lenovo updates. On this ThinkPad, the keys Fn+ScrLk activate the Numlock keypad function. The numlock light on the screen bezel works correctly, but there is no brief on-screen indicator, as there is w

  • Very anoyng proble

    Hi, I have an X-Fi XtremeGamer Fatalty Pro Series with the latest drivers on Win. XP, and the problem that I have is: I can't change the Bass, the treble and the equalizer because every time I chanche those I hear a very low laid back sound ?!? Have

  • Controlling Order Of Selected Applications Run Order

    I have a task sequence and I have static entries for all applications that are part of the default build. I have a list of optional applications that run when the "Install Applications" action is listed. I need to add a secure delete/format option. I

  • Any way to limit memory which XSLT processor uses?

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production PL/SQL Release 11.2.0.3.0 - Production CORE     11.2.0.3.0     Production TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - ProductionWe use the xml