SUM value by multiple conditions in SSAS

Hi All,
I have a condition like as below, but the SUM value not working in CASE STATEMENT. Anyone can help me...!
SUM(CASE [Calendar].[Calendar Date]
    WHEN [Calendar].[Calendar Date].[Year] = '2005' AND [Calendar].[Calendar Date].[Month] = 1
    THEN [Calendar].[Calendar Date].CURRENTMEMBER.CHILDREN
    END
, [Measures].[Work Day Flag])
Thanks in Advance...!
Baskaran

That is quite right Simon, although, technically, it's not a sum, you are simply getting the internet sales for january 2011, and you are overriding whatever selection is on the calendar date hierarchy. However, if that is what you want the calc to return,
perfect.
I would like to point out that WHEN [Calendar].[Calendar Date].[Year] = '2005' AND [Calendar].[Calendar Date].[Month] = 1
probably isn't what you want. If you want to know the Year of the current date, you might like to try something like the following
WHEN ancestor([Calendar].[Calendar Date],[Calendar].[Calendar Date].[Year]).member_caption
= '2005' AND ancestor([Calendar].[Calendar Date],[Calendar].[Calendar
Date].[Month]).member_caption = 'January'
Hope that helps,
Richard

Similar Messages

  • How to sum values from multiple lines in a DataTable?

    I have a Lookout program which uses a DataTable to allow users to write basic programs (relay on/off times, which relays change state, and pause times).  The DataTable cursor position changes to advance from one program stage to another.  
    What I would like to do is sum up the times from all the various stages.  Can anyone suggest how I might iterate through the DataTable using Lookout alone?  
    Thanks,
    Dave 

    I have tried to make 'loops' similar to that one but Lookout shows a message that iterations or loops for a variable are not allowed.
    You can use a sequencer but there are 2 inconvenients:
    1.- For a fast computer every step of the sequencer cannot be faster than 0.1 - 0.2 seconds. If you have many iteraciones, it will take some time.
    2.- The sequencer object has a maximimum of 100 steps.
    Ryan S. Here are questions for you:
    1.- Is there a way to add in the lks file statements and or functions using existing variables? What can be done and what not?
    2.- Is there a way to insert comments in the lks file?
    Thanks in advance.
    Rudy Lopez

  • Ssrs sum based upon a conditional statement

    In an ssrs 2008 r2 report, I have the following code that totals a transaction amount:
    =sum(cdec(Fields!TransactionAmount.Value))
    Now I need to have different total amounts based upon 'payment type'. The payment_types are either 'check', or 'credit' for credit card. Thus can you show me how to change the code I just listed to sum the amount depending upon the payment type?

    You may wish to follow this thread that is exploring a similar question.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/12e2cdf4-1fd7-4f2a-ba12-ff5c4ec01eeb/sum-values-based-on-condition-in-ssrs?forum=sqlreportingservices
    To do this in an SSRS expression just insert an IIf:
    =Sum(IIf(Fields!payment_type.Value = "check",cdec(Fields!TransactionAmount.Value),0))
    =Sum(IIf(Fields!payment_type.Value = "credit",cdec(Fields!TransactionAmount.Value),0))
    In the other thread you will see that sometimes it makes sense to do this kind of work in the dataset since dataset queries run on the datasource and often those systems are robust servers that can crunch and return data very quickly.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • Multiple Values For one Condition in Choose From List

    I have used one Business Partner Choose From List in my form but i want to give condition in that choose from list on GroupCode .But the condition will have multiple values like 100,102,104 then how i will write the code to incorporate multiple values for one single condition.

    Hi,
    Check this thread
    How to set a Multiple condition in a single CFL
    Hope that helps,
    Vasu Natari.

  • Advance Aggregation based on multiple conditions

    Hi members,
    I have a situation where I need to aggregate data based on multiple conditions. Relevant details of the problem is as follows.
    There is a table (let's call X). It has following columns:
    Transaction_Time (date)
    Transaction_direction (Possible values IN or OUT)
    Column_1
    Column_2
    Based on the columns: Transaction_direction, Column_1, Column_2, the type of the transaction will be derived. For example, if transaction_direction='IN' then transaction type is IN, if 'OUT' then transaction types are Out. Similarly if Column_1=Column_2 then transaction type is Txn_3 otherwise 4.
    Based on date and transaction types the aggregation will happen.The sample output would be:
    Time, Transaction type (IN, OUT, Txn_3, Txn_4), Sum of transactions
    10-June-2013 00:00  IN Transactions  2500
    10-June-2013 00:00  Txn_3 Transactions 3590
    and so.
    IN and Out transactions are easy to be derived using decode() function. However avoiding multiple UNION ALL and write a single SQL for all four conditions is tricky one.
    Hope I clarified.
    Neeraj

    What version of Oracle are you using?
    If you're on 11.x you can use the UNPIVOT feature as follows:
    with t (Transaction_Time, Transaction_direction, Column_1, Column_2) as (
    select date '2013-06-10', 'IN', 1, 1 from dual union all
    select date '2013-06-10', 'IN', 2, 2 from dual union all
    select date '2013-06-10', 'IN', 1, 2 from dual union all
    select date '2013-06-10', 'IN', 3, 4 from dual union all
    select date '2013-06-10', 'OUT', 3, 3 from dual union all
    select date '2013-06-10', 'OUT', 3, 4 from dual
    select * from (
    select
      transaction_time
    , sum(case when transaction_direction = 'IN' then 1 end)  as IN_count
    , sum(case when transaction_direction = 'OUT' then 1 end) as OUT_count
    , sum(case when Column_1 = Column_2 then 1 end)           as Txn_3_count
    , sum(case when Column_1 != Column_2 then 1 end)          as Txn_4_count
    from t
    group by transaction_time
    unpivot (
      txn_count for transaction_type in (
         IN_count as 'IN'
      ,  OUT_count as 'OUT'
      ,  Txn_3_count as 'Txn_3'
      ,  Txn_4_count as 'Txn_4'
    order by transaction_time, transaction_type
    TRANSACTION_TIME TRANSACTION_TYPE TXN_COUNT
    2013-06-10       IN               4      
    2013-06-10       OUT              2     
    2013-06-10       Txn_3            3      
    2013-06-10       Txn_4            3      
    If you're okay with getting one row per date with the 4 counts you can just use the inner select above, i.e.
    select
      transaction_time
    , sum(case when transaction_direction = 'IN' then 1 end)  as IN_count
    , sum(case when transaction_direction = 'OUT' then 1 end) as OUT_count
    , sum(case when Column_1 = Column_2 then 1 end)           as Txn_3_count
    , sum(case when Column_1 != Column_2 then 1 end)          as Txn_4_count
    from t
    group by transaction_time
    order by transaction_time
    TRANSACTION_TIME IN_COUNT OUT_COUNT  TXN_3_COUNT  TXN_4_COUNT
    2013-06-10       4        2          3            3      
    If you want to sum transaction amounts then use the same logic, except in the case statements replace 1 with the column you want to sum.
    Regards,
    Bob

  • If Statement Multiple Conditions

    Using LiveCycle, FormCalc or JavaScript.
    I am trying to create an if statement with multiple conditions.
    a Sum field calculates a series of numeric input fields. I want the result in the Sum field to determine the expression in a final field. 
    If the Sum is <30MM then "50000" also if the Sum is >30MM but <60MM then "125000" also if the Sum is >60MM but <100MM then "250000" also if the Sum is >100MM but <300MM then "375000" also if the Sum is >300MM then "500000"
    I have only been able to figure out a single if then for the first condition but not able to include the whole set of conditions and the multiple results.
    Help would be much Appreciated!
    Thank you in advance.

    Tried a few variations of this and still seem not
    to be able to find a solution to this issue. I'm surprised my google searches are bringing up better examples because there seems to be an example of everything else.
    Any more detailed advive?

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

  • Multiple conditions for the same button.

    Is there any way you can have multiple condition (same type of the condition).
    I have button that I would like to hide it at different stages.
    For example I would like to have a button (Submit) which will be visible when
    Status = Draft
    Condition Type Value of Item in Expression 1 = Expression 2
    P9_X_STATUS
    Draft
    and when also when userRole = author
    Condition Type Value of Item in Expression 1 = Expression 2
    P9_X_USER_ROLE
    Author
    Robert

    Hi,
    It would depend on when the fields get their values into the session. They may be below the button on the page but if they have a value in the session then the button's condition will see this.
    If, however, you have only used a Default Value setting for the item, the value may not be in the session (even though it may be displayed on the page), so the button will not know about this value. In these cases, I set the default value using a page computation for that item that runs "On Load Before Header" and is conditional on the item being null. That puts the value into the session for other items to use if required.
    Andy

  • Deleting data from another table with multiple conditions

    Hi frnds
    I need to delete some data from a table based on multiple condition I tried following sql but its deleteing some rows which is not meeting the criteria which is really dangerours. When i trying = operator it returns ORa- 01427 single -row subquery returns more than one row
    delete from GL_TXNS
    where TRN_DT in (Select trn_Dt from GL_MAT)
    and BR in (select ac_branch from GL_MAT)
    and CODE in (select CODE T from GL_MAT)
    and (lcy_amt in (select lcy_amt from GL_MAT) or
    fcy_amt in(select fcy_amt from GL_MAT)
    rgds
    ramya

    My answer is the same as Avinash's but I will explain a little bit more.
    ORa- 01427 single -row subquery returns more than one rowmeans that you have a subquery that Oracle is expecting one value from that is returning multiple values. In your case you need one value for the equijoin ("=") and you are getting more than one value back. The error happens even if all the values are the same - multiple values being returned will cause the error.
    The solution is to either allow multiple values to be returned (say, use the IN condition istead of "=") or only return one value if possible (say, forcing one value by using DISTINCT, GROUP BY, or a WHERE clause condition of ROWNUM=1) - but these workarounds must be checked carefully to make sure they work correctkly

  • Multiple condition : Error when starting a SWITCH branch

    Hi,
    In our Z Leave Workflow,I am facing the errors listed below.
    Error when starting a SWITCH branch
    Error during CASE evaluation in SWITCH mode for node 0000000158
    Operator 'EQ': The value of the left operand cannot be determined
    Error in the evaluation of expression '<???>&REQ.STATUS&' for item '1'
    Unable to determine the value of component ''
    It gives error in Multiple condition Request Approved? which is similar to standard WF12300111 node number 158 (u can say copy of WF12300111
    This multiple condition works in some scenario But it gives dump at other scenario .
    I have checked the value of REQ.STATUS in runtime. It populates the value as 'POSTED' in runtime,
    Please suggest if any solution on this.
    Regards,
    Kalpesh

    Hi There was some problem with task which was comprising class CL_PT_REQ_WF_ATTRIBS and APPROVE method. This method is to change the status of particular leave workitem.After running this particular task ,the status was not changin instantly.This method locks particular workitem and was releasing the workitem once the WF gets completed.Hence I was getting REQ.STATUS as sent.
    I have changed that task with following code in new task...
    DATA:
          REQUEST_ID TYPE PTARQ_DEDUCTION-REQUEST_ID,
    request      TYPE REF TO if_pt_req_request,
        new_status   TYPE tim_req_status.
      SWC_GET_ELEMENT CONTAINER 'REQUEST_ID' REQUEST_ID.
    CALL FUNCTION 'ENQUEUE_EPTREQ'
        EXPORTING
          mode_ptreq_header = 'E'
          request_id        = request_id
        EXCEPTIONS
          foreign_lock      = 1
          system_failure    = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
        MESSAGE w058(hrtim_abs_req) WITH request_id.
      ELSE.
    CALL METHOD ca_pt_req_header=>agent->get_request
          EXPORTING
            im_request_id = request_id
          IMPORTING
            ex_request    = request.
    execute state transition
        CALL METHOD request->initiate_state_transition
          EXPORTING
            im_transfer_event = 'APPROVE'
          IMPORTING
            ex_new_status     = new_status.
    COMMIT WORK.
        CALL FUNCTION 'DEQUEUE_EPTREQ'
          EXPORTING
            request_id = request_id.
    ENDIF.
    This will create new status for leave item during WF processing.
    Apart from that also added Wait for  2 minutes after that task....
    Thanks for your help.
    Regards,
    Kalpesh

  • Update value of Pricing condition

    Hi all,
    I am having existing custom program in which sales order get display through ALV. and when user select records through ALV and execute, All pricing conditions of selected sales order gets updated. For this BDC is written( in which Update button is clicked on condition tab at line item in sales order)
    My requirement is to add new field for pricing condition on selection screen.  and if user  puts any pricing condition on the field,  only that pricing condition should get updated with new value for selected  sales order. It should not update all the pricing condition for the sales order.
    Problem: I can not use BDC in this particular case because if i use Update button on condition tab(line item ) in sales order  on BDC, it will update all the pricing condition of sale order.
    Question: How i will trace new value of any pricing condition. Functional are saying that it is maintained in VK13. If this is a case
    then
    1)How I will come to know in which config table, Condition record exist  i.e New value of pricing .
    2)Each pricing Condition will have multiple condition tables ( Lot of combinations) and I will come to know about the tableu2019s    only at runtime. For getting the values from  table I need the value of there respective key fields.
    How I will get the values of all the key fields of  the condition tables ?
    If there is any better way to get the new reprising value of pricing condition please let me know?
    Thanks in advance

    Hi,
    Please check if any other standard pricing types suits your requirement.  Assuming that your current pricing type is 'B'-carry out automatic pricing. So, when you update pricing, you can choose the best that suit your case.
    [http://help.sap.com/saphelp_46c/helpdata/en/dd/560f03545a11d1a7020000e829fd11/content.htm]
    Regards,
    P Gomatheeswaran

  • About case and switch in multiple condition step in workflow.

    i ve some information about case and switch in multiple condition in workflow.
    case - static determination
    switch - runtime determination.
    but i want brief explanation about case and switch and difference please help me.....

    hi velmurugan............
        in case,
               we can have only one value for comparison and can have any number of branches for it.
       in switch,
               we can compare any number of values and have any number of branches.
    eg:
         consider i am triggering a workflow for purchase order change and i am having a multiple condition step.
    if i am going for a case:
            i can have only on value (ie po number/vendor number.....) as a parameter and can check different values with it. ( eg vendor number < 1000
                                                                 vendor number > 1000.... so on)
            a branch will be created for each condition.
    if i am going for a switch:
            i can take any parameter needed. (eg: vendor number > 1000
                                                                    order type = 'NB' .... so on)
             so a single branch can have any number of comparisons with the help of 'and' and 'or' operators and i can have any parameter for my condition.
    ---regards,
       alex b justin

  • Understanding multiple conditions in connect by prior clause Oracle

    Hi ,
    Can some one please explain me how to comprehend/understand  multiple conditions in connect by prior conditions with some example data.
    I am creating a table like this
    CREATE TABLE FAMiLY_TREE
    GRAND_FATHERID number,
    FATHER_ID number,
    SON_ID number,
    person_name varchar(20)
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (NULL, NULL , 5 , 'Mr X ' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (null, 5 , 6 , 'Dave' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (5, 6 , 7 , 'Vinny' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (5, 6 , 16 , 'Omy' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (5, 6 , 17 , 'Vijjy' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (6, 7 , 8 , 'Vicky' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (6, 7 , 9 , 'Varis' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 8 , 10 , 'Vshnu' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 8 , 11 , 'dyna' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (8, 10 , 14 , 'Marry' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (8, 10 , 15 , 'Mac' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 9 , 12 , 'Garry' );
    INSERT INTO  FAMILY_TREE (GRAND_FATHERID ,FATHER_ID , SON_ID , PERSON_NAME ) VALUES
    (7, 9 , 13 , 'Ganny' );
    SELECT
    LPAD(' ', LEVEL*3) || PERSON_NAME FROM FAMILY_TREE
    START WITH SON_ID= 6
    CONNECT BY PRIOR SON_ID = FATHER_ID
    AND PRIOR FATHER_ID = GRAND_FATHERID ;
    SELECT
    LPAD(' ', LEVEL*3) || PERSON_NAME FROM FAMILY_TREE
    START WITH SON_ID= 6
    CONNECT BY PRIOR SON_ID = FATHER_ID ;
    Both These query return the same o/p
       Dave
          Vinny
             Vicky
                Vshnu
                   Marry
                   Mac
                dyna
             Varis
                Garry
                Ganny
          Omy
          Vijjy
    Can some one please explain me comprehension of both these query or give me a example where i can understand multiple connect by prior conditions
    Thanks

    Maybe (something to play with)
    with
    family_tree as
    (select 'Green' family,null ancestor,1 person,'Mr X' person_name,1900 born from dual union all
    select 'Green',1,2,'Dave',1920 from dual union all
    select 'Green',2,3,'Vinny',1940 from dual union all
    select 'Green',2,4,'Omy',1945 from dual union all
    select 'Green',2,5,'Vijjy',1950 from dual union all
    select 'Green',3,6,'Vicky',1960 from dual union all
    select 'Green',3,7,'Varis',1965 from dual union all
    select 'Green',6,8,'Vshnu',1980 from dual union all
    select 'Green',6,9,'Dyna',1985 from dual union all
    select 'Green',8,10,'Mary',2000 from dual union all
    select 'Green',8,11,'Mac',2005 from dual union all
    select 'Green',7,12,'Garry',1985 from dual union all
    select 'Green',7,13,'Ganny',1990 from dual union all
    select 'Brown',null,14,'Joe',1950 from dual union all
    select 'Brown',14,15,'Jim',1970 from dual union all
    select 'Brown',14,16,'Joy',1975 from dual union all
    select 'Brown',14,17,'Jay',1980 from dual union all
    select 'Brown',16,18,'Jack',1995 from dual union all
    select 'Brown',18,19,'Jake',2010 from dual union all
    select 'Brown',18,20,'Jess',2012 from dual
    select family,
           root_name||' ('||to_char(root_born)||')' "(FA/MO)THER",
           children
      from (select family,
                   root_born,
                   root_name,
                   ltrim(sys_connect_by_path(person_name||' ('||to_char(born)||')',', '),', ') children
              from (select family,
                           connect_by_root(person_name) root_name,
                           connect_by_root(born) root_born,
                           person_name,
                           born,
                           row_number() over (partition by family,connect_by_root(person_name) order by born) rn
                      from family_tree
                     where level = 2
                    connect by prior person = ancestor
             where connect_by_isleaf = 1
             start with rn = 1
            connect by prior root_name = root_name
                   and prior family = family
                   and prior rn + 1 = rn
    order by family desc,root_born
    Regards
    Etbin

  • Multiple Condition Issue

    Hi Experts,
    I have a problem of trying to utilize multiple conditions on a query. I have two conditions like this:
    keyfigure A < 0
    keyfigure A Bottom 10
    What is happening is that it is finding the bottom 10 values and then filtering out the values. So instead of displaying 10 values, I only get a few.
    I have tried changing the order of the conditions and such, but it doesn't seem to affect the results. I currently have the two conditions mentioned above in separate conditions. (My understanding is that this produces an AND effect.)
    Any thoughts on how to force it to do the filtering first and then order?
    Thanks in advance.

    Have you tried using a pre-query? That way, the first selection is forced to happen before the second.
    Here's the Help documentation... once you understand how to use it, its very powerful.
    http://help.sap.com/saphelp_nw04/helpdata/EN/2c/78a03c1178ad2ce10000000a114084/content.htm
    Points?
    PAtrick

  • Error in multiple condition type switch

    Hi,
    I define a multiple condition as a switch for different processing branches for my
    Workflow (all my attributes in the conditions are from the object).
    I defined the Other Values outcome also.
    When one of the conditions is true I received an error SWP103 "Error when starting a SWITCH branch"
    It works fine when my process go to "other" outcome.
    Thanks in Advance,
    Ronit.

    In my workflow the same error occured while using a mutliple condition with type Switch.
    A short explanation of my workflow:
    - container operation: errorcounter = errorcounter + 1
    - multiple condition
      1. errorcounter =< 4
      2. errorcounter = 5
      3. other values
    - activity
    - loop until (depending on outcome activity).
    The first time while executing the loop went perfect, but the second time it failed and based on the message I guess it failed on the multiple condition. What I also notices in the technical view was that the errorcounter wasn't updated.
    I guess the container operation and multiple condition bumped into eachother (somehow?) and caused the error.
    My solution:
    Put a wait stap between step 1 and 2 and it works fine.
    I'm not sure this case is applicable to you, but may be a hint in the right direction. Good luck!

Maybe you are looking for

  • Recording audio from my pc speake

    I just recently put a different sound card in my computer (Sound Blaster Li've 6) and now I can't seem to record streams or sounds off the internet like i was doing with my previous sound card. I was previously recording through the mix-record source

  • Ipod Classic 5th Generation problem

    i have a ipod classic 5th generation connected it to my macbook pro retina display and it doesn't come up on itunes but it does charge? can anyone help

  • Film transfer from COLOR

    Hi, I'm a student film maker just completed shooting my diploma project on RED ONE and planned the entire workflow on FINAL CUT STUDIO. It's just seemless but the final output should be delivered on FILM. My questions: Which FILM RECORDER should be u

  • I5-2520M 2.5 GHz Mac mini has slowed dramatically

    It was fine when I bought it last December and stayed fine after installing Windows 7 on its own partition with Bootcamp. Then it started gong to **** and upgrading to Mountain Lion didn't help. Both Mac and Windows are painfully slow on the internet

  • Siebel CRM on-demand URGENT help

    Hi, I am in urgent need with the help on the following 3 actions I need to undertake today. I hav not used Siebel CRM for about 2 years and am in urgent need of assistance if anyone can help it would be MUCH appreicated. ·     Enter the business card