Case statement problem for a column in BMM layer

Hi friends.
In physical layer I've a "cardio" column whose data type is INT, and two values comes here either 0 or 1.
I need to replace 1 by 'YES' and 0 by "NO'.
For that I changed the datatype of "Cardio" column to CHAR. and in BMM layer I'm using this formula
CASE WHEN "A Analysis"."C Report"."CARDIO" = '1' THEN 'Yes' ELSE 'No' END
But this is giving me "Invalid Expression" error.
Please help me correct this error.
Help appreciated.

Hi,
Your are probably using the column Cardio as a 'source' and as a 'target'.
So you have to duplicate the cardio column (right mouse click and Duplicate option) in the business model and then apply the formula CASE WHEN "A Analysis"."C Report"."CARDIO" = '1' THEN 'Yes' ELSE 'No' END
That should work. It is not even necessary to change datatype of Cardio, OBI will handle this for you.
Regards
Edited by: wobiee1 on Nov 12, 2008 1:07 PM

Similar Messages

  • SSIS: Using CASE Statement Within A Derived Column Transformation Expression

    The following is my Data Flow:
    Ole DB Source > Copy Column > Derived Column >Ole DB Command
    My OLE DB Source has the following SQL command task:
    SELECT *
    FROM Repair R
    LEFT OUTER JOIN Vehicle V
    ON R.SN = V.SN
    AND R.Reg = V.Reg
    LEFT OUTER JOIN Product P
    ON R.PID = P.PID
    This yields a column of concern for me named PartNumber, which are represented by the following 2 formats:
    The following are my Copied Columns:
    Input Column = PartNumber
    Output Alias = Copy of PartNumber
    The following are my Derived Column expressions:
    Derived Column Name Derived Column Expression
    Name Replace 'PartNumber' LEFT(PartNumber,FINDSTRING(PartNumber,"-",1) - 1)
    Copy of Name Replace 'Copy of PartNumber' RIGHT([Copy of PartNumber],LEN([Copy of PartNumber]) - FINDSTRING([Copy of PartNumber],"-",1))
    So My PartNumber Column is Replaced with ######### of type
    string and the Copy of PartNumber column is replaced with
    #### of type int
    As I stated earlier PartNumber also is in the format of %-%-% which raises the following question:
    How can I replace PartNumber Column with NULL if in format of
    %-%-% and take the PartNumber and put it in new column named
    SubPart while keeping all the logic within SSIS objects?
    So in essence I want to do something like the following:
    PartNumber = CASE
    WHEN 'PartNumber' LIKE '%-%-%'
    THEN ABC = PartNumber AND PartNumber IS NULL
    END
    I have tried the case statement in a Derived Column expression and is not working. Would I add the
    CASE statement to the SQL command task in my OLE DB Source?
    I hope this question is concise for you.

    If it must be in SSIS, I would put a derived column stage earlier in the process to do my check for me. Then in the second derived column stage do the check against each output column (part, subpart, copy of part) to decide which way it goes
    PS Not sure if it's a 2012 function but SSIS has a function called TOKEN that will allow you to pull your subparts for you rather than the left/right you are doing

  • Update with case statement problem.

    Hi,
    I have this statement
    update tab_tr set col_rate =
      case
      when col_ern_type in ('031','035','036') then (1.5 * col_rate)
      when col_ern_type in ('041','045','046') then (2 * col_rate)
    end;this statement updated some 2 million rows in the table tab_tr. But the total count of rows for col_ern_type in ('031','035','036', '041','045','046') yeild only around 222642 rows.
    select count(*) from tab_tr where col_ern_type in ('031','035','036', '041','045','046');  --> 222642 rowswhat is the problem with the above update statement.
    Thank you,

    Hi,
    DBA_1976 wrote:
    ... I thought the case statement conditions are counted as the where condition. But ......A CASE expression just takes the place of some other expression, such as a literal, a function, or a column.
    For example, which rows do you think this should update?
    UPDATE  tab_tr
    SET     col_rate  = 100;It would update all rows, of course.
    How about this statement?
    UPDATE  tab_tr
    SET     col_rate  = column_x;Will it only change the rows where column_x are a certain value, or not NULL, or in any way depend on column_x? No, of course not. It will update all rows.
    How about this statement?
    UPDATE  tab_tr
    SET     col_rate  = function_y (col_ern_type);Will it only change the rows where the fucntion returns a certain value? Will it depend on the value in col_ern_type? No, of course not. It calls the function for each row, and whatever the function returns (even if the function returns NULL), that's what goes into col_rate on each row.
    A CASE expression is just something that you can substitute in place of any other expression, such as the literal 100, or the column column_x, or the function function_y in the statements above. Naturally, the value that gets put into col_rate will depend on what the CASE expression returns, but the behavior of the UPDATE statement as a whole will not.

  • Case statement problems in oracle forms 6i

    Hello,
    Any one can help me that how to use case statment in Oracle forms 6i.
    i have read one thread and there was no proper solution so could any one please let me know to use case statement.
    Please also let me know which category i should search for FORMS 6i.
    when i'm using below code with cursor then i'm getting error 103
    database:=11g
    application := forms 6i
    operating system:= win Xp
    code is given below :-
    cursor c1 is
    select nc.nomenclature_id,
    nvl(nc.category_value, 0) master,
    nvl(nc2.category_value, 0) case,
    nvl(nc3.category_value, 0) bundle,
    case
    when nvl(nc.category_value, 0) > 0 and
    nvl(nc2.category_value, 0) > 0 and
    nvl(nc3.category_value, 0) > 0 then
    'A' --All packouts Master, Case, Bundle
    when nvl(nc.category_value, 0) > 0 and
    nvl(nc2.category_value, 0) > 0 and
    nvl(nc3.category_value, 0) = 0 then
    'B' --Both Master and Case
    when nvl(nc2.category_value, 0) = 0 and
    nvl(nc3.category_value, 0) = 0 then
    'C' --Master Case Only
    else
    'N'
    end code
    from nomn_category nc, --master case
    (select nc2.nomenclature_id,
    nc2.category_value
    from nomn_category nc2
    where nc2.category_id = '230732') nc2,
    (select nc3.nomenclature_id,
    nc3.category_value
    from nomn_category nc3
    where nc3.category_id = '236566') nc3
    Edited by: Rahul on Feb 3, 2012 7:18 PM
    Edited by: Rahul on Feb 3, 2012 7:20 PM

    hello Andreas,
    It is ok but i dont have to use view there.
    i need to use without view, because this code has to be use in FORMS6i.
    But Forms6i doesn't support to case function. i'm newbie in Forms.
    If you can convert to below bold one portion(case) into decode then please help me or
    if you have any idea about Forms6i then please send me any link where is given explanation about excel report that how to make excel report through Forms6i step by step and that excel report should be generate on any dynamic path which is given by user:-
    cursor c1 is
    select nc.nomenclature_id,
    nvl(nc.category_value, 0) master,
    nvl(nc2.category_value, 0) case,
    nvl(nc3.category_value, 0) bundle,
    case
    when nvl(nc.category_value, 0) > 0 and
    nvl(nc2.category_value, 0) > 0 and
    nvl(nc3.category_value, 0) > 0 then
    *'A'*
    when nvl(nc.category_value, 0) > 0 and
    nvl(nc2.category_value, 0) > 0 and
    nvl(nc3.category_value, 0) = 0 then
    *'B' --Both Master and Case*
    when nvl(nc2.category_value, 0) = 0 and
    nvl(nc3.category_value, 0) = 0 then
    *'C'*
    else
    *'N'*
    end "code"
    from nomn_category nc,
    (select nc2.nomenclature_id,
    nc2.category_value
    from nomn_category nc2
    where nc2.category_id = '230732') nc2,
    (select nc3.nomenclature_id,
    nc3.category_value
    from nomn_category nc3
    where nc3.category_id = '236566') nc3
    thanks

  • Case Statement problem

    Hi All,
    I am trying to come up with a case statement for the below provided sql but i am not able to do that can you guys help me out
    (SELECT NO_OF_DAYS.id_person
    FROM NO_OF_DAYS
    WHERE NO_OF_DAYS.STATUS = 'Y'
    AND NO_OF_DAYS.ID_PERSON = PERSON.ID_PERSON
    HAVING (SUM( NO_OF_DAYS.DT_STAT_END
    - NO_OF_DAYS.DT_STAT_START)) > 180)
    the case statement i am trying to come up with is if the person status start - end date is greater than 180 days then 'y' else 'n' end

    Hi.
    If you have two tables: NO_OF_DAYS and PERSON and PERSON is a parent table of NO_OF_DAYS this could work:
    WITH NO_OF_DAYS AS
         SELECT 1 id_person,TO_DATE('2012-01-01','YYYY-MM-DD') DT_STAT_START, TO_DATE('2012-01-31','YYYY-MM-DD') DT_STAT_END,'Y' status FROM dual UNION
         SELECT 1 id_person,TO_DATE('2012-02-01','YYYY-MM-DD') DT_STAT_START, TO_DATE('2012-02-20','YYYY-MM-DD') DT_STAT_END,'Y' status FROM dual UNION
         SELECT 2 id_person,TO_DATE('2012-01-01','YYYY-MM-DD') DT_STAT_START, TO_DATE('2012-03-31','YYYY-MM-DD') DT_STAT_END,'Y' status FROM dual UNION
         SELECT 2 id_person,TO_DATE('2012-04-01','YYYY-MM-DD') DT_STAT_START, TO_DATE('2012-10-01','YYYY-MM-DD') DT_STAT_END,'Y' status FROM dual
    PERSON AS
         SELECT 1 id_person FROM DUAL UNION
         SELECT 2 id_person FROM DUAL
    SELECT
         NO_OF_DAYS.id_person,
         CASE WHEN (SUM(NO_OF_DAYS.DT_STAT_END- NO_OF_DAYS.DT_STAT_START)) > 180 THEN 'Y'
              ELSE 'N'
         END y_n
    FROM
         NO_OF_DAYS,
         PERSON
    WHERE
         NO_OF_DAYS.ID_PERSON = PERSON.ID_PERSON AND
         NO_OF_DAYS.STATUS = 'Y'
    GROUP BY NO_OF_DAYS.id_person;
    --results
    ID_PERSON     Y_N
    1          N
    2          YHope this helps.
    Regards.

  • Count on a column In BMM Layer of Obiee

    Hi All,
    How to implement below SQL in OBIEE BMM layer
    SELECT   COUNT ( * )
                FROM  dept, emp
               WHERE       emp.origrecordid = dept.depno
                     AND emp.empname = 'xyz'
    Please help me on this

    create a metric with expression
    count(employee_id)
    the value for this metric will vary based on columns selection on Answers
    ~ http://cool-bi.com

  • Where condition for a column in BMM

    Hi Gurus,
    I have a requirement where in the BMM(The LTS for this logical table is say 'Fact'), I need a logical column with the following definition.
    count(Dim.status) where Dim.status = ' Accepted' (I didnt add the Dim table to the LTS yet, should I?)
    I know that we can do a count(Dim.status) in the column source . but for the where Dim.status = ' Accepted' part im not sure what to do.
    Should I bring the Dim table as a LTS and define the 'where' condition in the content tab? will that work?
    but what if I have another logical column where I need dim.Status = 'Declined'( we have many more status)
    Plz help

    The suggest statement as Filter(count(Fact.Dollars) Using("dim.status = 'accepted'))
    is based on Answers, this would care about the column is available in Subject Area or not thats it.
    The same kind of functionality can get the using rpd.
    There you might need to map/add (fact source properties and then map using pencil icon on 11g add button in 10g) the dim table to the fact
    so that you can get the expression based on physical columns as
    case when dim.status = 'accepted' then Fact.Dollars else 0 end
    use Aggregate tab for sum;
    Since you are using Fact.Dollars it suppose to be sum, ROW_WIDs go by counts
    Hope this helps :) for more Qs send email
    If helps mark

  • Update statement problem for jdbc adapter

    Hi all
    In the jdbc sender adapter, I configured as follows:
    Query statement
    select * from pickdiff where tid is null
    Update statement
    delete from pickdiff where tid is null
    I got following error message:
    Database-level error reported by JDBC driver while executing statement 'delete from pickdiff where tid is null'. The JDBC driver returned the following error message: 'java.sql.SQLException: [SQLServer 2000 Driver for JDBC][SQLServer]Die Unterabfrage gab mehr als einen Wert zurück. Das ist ungültig, wenn die Unterabfrage auf =, !=, <, <= , >, >= folgt oder als Ausdruck verwendet wird.'. For details, contact your database server vendor.
    If I change the Update statement to
    update pickdiff set tid = 'sapxi' where tid is null
    Then everything is ok.
    Doese any one have some idea about this problem?
    Regards
    Hui

    Hi,
    The below statements are from SAP help...
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/frameset.htm
    The UPDATE statement must alter exactly those data records that have been selected by the SELECT statement. You can ensure this is the case by using an identical WHERE clause. (See Processing Parameters, SQL Statement for Query, and SQL Statement for Update below).
    &#9679;      Processing can only be performed correctly when the isolation level for transaction is set to repeatable_read or serializable.
    SQL statement for query: SELECT * FROM table WHERE processed = 0;
    SQL statement for update: UPDATE table SET processed = 1 WHERE processed = 0;
    processed is the indicator in the database.
    please see if setting the isolation level would help....Also are you getting this error always or is it intermitent ?
    Thanks,
    Renjith

  • Case Statement into XML , XMLType column

    We are storing following(example) xml into xmltype column (column name xmlfile , table name xml_table) .
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <context id="reporting_options">
          <scenario>
             <abc:isAllow>false</abc:isAllow>
          </scenario>
       </context>
       <abc:tab1 contextRef="con1">89841</abc:tab1>
       <abc:tab1 contextRef="con2">-18514</abc:tab1>
       <abc:tab2 contextRef="con1">89841</abc:tab2>
       <abc:tab2 contextRef="con2">-18514</abc:tab2>
       <abc:tab3 contextRef="con1">By Current/Non-Current Classification</abc:tab3>
       <abc:tab3 contextRef="con2">0</abc:tab3>
    </xml>I want to extract the values for tab1 .. tab3 based on * <abc:isAllow>false</abc:isAllow>*. Now i'm doing in following way.Note , based on abc:isAllow values i need to pick contextRef="con1" or contextRef="con1".
    select
    case extractValue(xmlfile ,'//abc:isAllow', 'xxx:bac="http://www.abc.com/abc"')
      when 'true' then extractValue(xmlfile ,'//abc:tab1[@contextRef="con1"]', 'xxx:bac="http://www.abc.com/abc"')
      else  extractValue(xmlfile ,'//*abc:tab1*[@contextRef="*con2*"]', 'xxx:bac="http://www.abc.com/abc"')
      end as tab1,
    case extractValue(xmlfile ,'//abc:isAllow', 'xxx:bac="http://www.abc.com/abc"')
      when 'true' then extractValue(xmlfile ,'//abc:tab2[@contextRef="con1"]', 'xxx:bac="http://www.abc.com/abc"')
      else  extractValue(xmlfile ,'//abc:tab2*[@contextRef="con2"]', 'xxx:bac="http://www.abc.com/abc"')
      end as tab2,
    case extractValue(xmlfile ,'//abc:isAllow', 'xxx:bac="http://www.abc.com/abc"')
      when 'true' then extractValue(xmlfile ,'//*abc:tab3*[@contextRef="con1"]', 'xxx:bac="http://www.abc.com/abc"')
      else  extractValue(xmlfile ,'//abc:tab3[@contextRef="con2"]', 'xxx:bac="http://www.abc.com/abc"')
      end as tab3
    from xml_tableI think , above query might not be optimized because "case when" part will ready abc:isAllow for each tag. and my actual xml is containing more than 200 tag. Any one suggest good way to handle this query.
    Regards,
    thees_k.

    TrySELECT XMLTYPE.GetClobVal
              (XMLELEMENT
                    ("variable",
                     XMLAttributes('vcInternationalDate[]' AS "type"),
                     XMLAGG(XMLELEMENT("item",
                                       CASE
                                          WHEN TEMPO IS NOT NULL
                                          THEN XMLELEMENT("utc", TO_CHAR(TIME, 'dd/MM/yyyy HH24:MI:SS'))
                                       END),
                            XMLELEMENT("timezone_offSet", TIMEZONE)))) AS "CREATIONDATE"
      FROM twgenericosdb.TEST
    WHERE ID = 1You could replace CASE with NVL2SELECT XMLTYPE.GetClobVal
              (XMLELEMENT("variable",
                          XMLAttributes('vcInternationalDate[]' AS "type"),
                          XMLAGG(XMLELEMENT("item",
                                            NVL2(TEMPO,
                                                 XMLELEMENT("utc", TO_CHAR(TIME, 'dd/MM/yyyy HH24:MI:SS')),
                                                 NULL),
                                            XMLELEMENT("timezone_offSet", TIMEZONE))))) AS "CREATIONDATE"
      FROM twgenericosdb.TEST
    WHERE ID = 1Urs
    Edited by: metzguar on 06.05.2010 15:04

  • SQL Case Statement Problem with Maxdb

    Hello,
    I'm running a J2E application on Netweaver AS. I have on problem that I just cannot figure out.
    The statement works in SQL Studio but when I try to code it it does not work at all.
    select COLA, SUM(CASE WHEN COLB=10 THEN 1 ELSE 0 END) from TABLE group by COLA
    When executed as statement in Java I get:
    Error [javax.servlet.ServletException: java.lang.IllegalStateException: illegal stack size: 4
    contents:
    com.sap.sql.tree.SelectStatement
    com.sap.sql.tree.IntegerLiteral
    com.sap.sql.tree.IntegerLiteral
    com.sap.sql.tree.ComparisonPredicate], with root cause [java.lang.Exception: java.lang.IllegalStateException: illegal stack size: 4
    contents:
    com.sap.sql.tree.SelectStatement
    com.sap.sql.tree.IntegerLiteral
    com.sap.sql.tree.IntegerLiteral
    com.sap.sql.tree.ComparisonPredicate].
    Any thoughts on that? Thanks!
    Edited by: MD on Feb 18, 2009 7:37 PM

    Hi MD,
    with SQL Studio you mean you work with MaxDB?
    Are you sure you're working directly on MaxDB and not with OpenSQL? (That's different!)
    If you want the first, try setting SQL type "vendor" or "native sql". In such case you have to define a new custom datasource through configuration. How that works depends on the version you are using.
    Try to find out what the actual error message is. The stack trace is not enough. There should be more.
    Regards,
    Benny

  • Case statement logic for External Tables

    Hi All,
    Is there anyway I can perform a CASE logic in External table creation script?
    I have a column which is supposed to receive only Numbers. But if i inadvertently receive a String, i want to insert NULL for that instance.
    My table has the following creation syntax: ( I have to make a check for the NumValue column - althought I am using VARCHAR2(50) I have the transformation stage where the NumValue column has a CASE logic ; my entire file is getting rejected just because a single row in the input dat file is coming as a String)
    CREATE TABLE XYZ_TABLE
         LineNumber NUMBER(20),
         NumValue VARCHAR2(50 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY "EXT_TAB_DIR"
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
    BADFILE 'EXT_TAB_DIR_LOG':'FILE1.BAD'
    LOGFILE 'EXT_TAB_DIR_LOG':'FILE1.LOG'
    DISCARDFILE 'EXT_TAB_DIR_LOG':'FILE1.DSC'
    FIELDS TERMINATED BY '#|#'
    OPTIONALLY ENCLOSED BY '#$' and '$#'
    MISSING FIELD VALUES ARE NULL(
    LINENUMBER,
         NUMVALUE
    LOCATION
    ( 'FILE1.dat'
    REJECT LIMIT UNLIMITED;
    Thank you,
    Chaitanya

    Chaitanya wrote:
    So here, in the CASE logic, can i perform a check for validating if the value received for NumValue is only number and not some Varchar2 value (which I am currently receiving for some rows)Assuming "is only number" means NumValue column can containg digits only:
    insert
      into TableABC(
                    linenumber,
                    nuvalue
      select  linenumber,
              NumValue
        from  TABLEXYZ
        where regexp_like(NumValue,'^\d+$')
    /SY.
    P.S. If NULL column NumValue is allowed, add OR NumValue IS NULL

  • How to solve this case sensitive problem for the parameters in function?

    Hi,
       I have a function, which should receive one parameter comes from textbox in BSP form. User will input upper case or lower case characters together in this textbox. But when I debug function, I found after function recevice the value from BSP form, the string value was converted into upper case automatically.
       I don't want system convert string to upper or lower case. I want keep the original value that user inputted.
       So is it possible to do this?
       Thanks!

    Hi,
       Thanks for your reply.
       Yes, I use the inputfield. The problem is if I use the parameter which contain user's input in the event handler of BSP, the value is equal to the user's input. But if the parameter was transfered into function, the value was converted to uppercase.
       But I want to keep  the original value.
       Thanks!

  • MERGE Statement Problem for Storing Old Data

    Hi,
    I am using MERGE statement to update as well as insert rows on ta table.
    I have a data like in a table 'TABLEA' as 10 20 30 ABCD
    I want to update the table using 10 20 30 DEFG but i want the old data i.e 10 20 30 ABCD
    to store in a History table i.e TABLEA_H.
    Is there any way to store the data
    Any help will be needful for me

    Hi,
    Trigger usage may affect the performance as we are handling Production environment.
    is there any way to implement the scenario without using Triggers?
    Any help will be needful for me

  • MEREQ001 User Exit Problem for ALV Columns.

    Hello,
    I am using this user exit to make changes to the Purchase requisition enjoy transaction. There is an ALV used for item details and if you use the customer CI_EBANDB include in EBAN table you can see those fields available in the alv and you can add them up using change layout.
    To make these fields editable as they remain in display always inspite of the fact that you use ME51n or ME52n.
    MM --> Purchasing --> Purchase Req -->Define Scree Layout at document level.
    is the configuration required as per a previous mail thread in the forum. However when i go to spro i am not able to see those new fields which i have added for KEY FIELD selection. Am i missing something or has anybody before done this... Could anybody guide me with the step by step process.
    Regards,
    Shekhar Kulkarni

    Hello,
    In 46C, I checked and found no user exits / BADIs for your requirement. If you are very keen of this feature, may be that you have to modify the SAP standard. Not a good option.
    Regards, Murugesh AS

  • Problem to identify values in a case statement.

    Hi Friends,
    Total number of records in my report should be divided by 5 and to be alloted into 5 grades in Grade column.
    This is what I have done so far in my report with following layout.
    S.No - Col A - Col B - Col C - Grade ( Colums A,B,C will be hidden in Report)
    *****Column C will have only 5 values at max ( 0.0, 0.2, 0.4, 0.6, 0.8).The below example is for 6 records in a report.The same will be applied for 7,8,9,10 records.
    In column A: MAX(cast(RCOUNT(1) AS DOUBLE))/5 ( Ex : 6/5 = 1.2)
    In Column B: Truncate(MAX(cast (RCOUNT(1) as double)/5), 0) ( Ex : 6/5 = 1.0)
    In Column C: Col A- Col B ( EX:1.2 - 1.0 =0.2)
    (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0))
    Now In Grade coulum I want to use this column C to Grade the records with case statements in it.
    I am trying to use the following case statement for Grade Coulmn
    Case
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.0 then .........
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.2 then .............
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.4 then .............
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.6 then ........
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.8 then .....
    end
    Case statement works gud for 0.0 but not for other 4 values.
    It is unable to identify other 4values.
    Please tell me, how can I make case statement work for all values in above scenario.
    Thanks in Advance,
    Varsha.
    Edited by: Varsha on Nov 28, 2010 6:23 PM

    In column A: MAX(cast(RCOUNT(1) AS DOUBLE))/5 ( Ex : 6/5 = 1.2)
    In Column B: Truncate(MAX(cast (RCOUNT(1) as double)/5), 0) ( Ex : 6/5 = 1.0)
    In Column C: Col A- Col B ( EX:1.2 - 1.0 =0.2)
    (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0))Change the formula a bit by adding the by dim value for the MAX column.
    Column A: MAX(cast(RCOUNT(1) AS DOUBLE) by DimTable.Column)/5
    Column B: Truncate(MAX(cast (RCOUNT(1) as double) by DimTable.Column)/5, 0)
    Column C: MAX(cast(RCOUNT(1) AS DOUBLE) by DimTable.Column)/5 - Truncate(MAX(cast (RCOUNT(1) as double) by DimTable.Column)/5, 0)
    now write a case statement on top column c, based on your logic every 5th record will have a value 0.0
    Note: Dimtable.column is the table.column for which the row count is taken.
    Thanks,
    Vino

Maybe you are looking for