In SSRS, aggregate measure based on dimension value

I am writing an SSRS 2012 report whose data source is an SSAS cube. In one table of this report, I am using a very simple data set with one dimension (Category) and one measure (Sales). The dimension has 4 members, A B C D. For the purposes of this
report table, I want to show the sum of sales for A, the sum of sales for C, and the sum of sales for B and D combined. I then want to show each of these 3 values as a percent of the total (sum of A B C D).
The data set looks like this:
CATEGORY   SALES
A                10000
B                14000
C                 8000
D                 8000
The resulting report table should look like this:
CATEGORY SALES % OF TOTAL
A                10,000      25.0
B+D            22,000      55.0
C                 8,000       20.0
TOTAL         40,000

Hi ,
As you mentioned you need such aggregation in SSRS and you are using SSAS datasource.
so you can achieve this using MDX Query.
I have done this in my environment . I took below for achieving this
Dimension : Category
Relationship : There should be Facttable relationship with Dimension table Category.
Measure : Unit Price (in your case sale)
Please find below solution using MDX Query.
Please share if you have any doubt.
Thanks

Similar Messages

  • New calculated member based on existing measure and a dimension value

    Hi
    I’m trying to create a new calculated member in my cube based on an existing measure and a dimension value.
    I can do it easily in DSW but I want to do it as a Calculated Member in Calculations tab from my cube.
    I have a dimension called Product in which one attribute is UOM (unit of measure) and a measure called Quantity. The relationship with the fact table is “Regular”.
    For each product we have a unit of measure and an associated quantity measure:
    Product Name   
    UOM     Quantity
    Product 1   
              Km  
             50
    Product 2   
              Kg   
             60
    Product 3   
              Kw 
              25
    Product 4              L               
    15
    Product 5              T     
             1.5
    Total                                     151.5
    The calculated member I want to create is “Kw” and has to contain the value from Quantity measure when Product.UOM is “kW” and should look like this:
    Product Name   
    UOM     Quantity   
    Kw
    Product 1   
              Km  
             50           
    Product 2   
              Kg   
             60
    Product 3   
              Kw 
              25           
     25
    Product 4              L  
                 15
    Product 5              T     
             1.5
    Total                                     151.5        
    25
    So far I tried using the MDX with “IIF” or “Case” but with no results.
    What statement I should use in this case?
    Thank you.

    Hi Cees,
    Thank you for your answer.
    I never used yet the “Scope” statement and yet it’s an elegant solution.
    I use it as in your example:
    CREATE
    MEMBER CURRENTCUBE.[Measures].[Kw]
    AS NULL,
    FORMAT_STRING =
    VISIBLE = 1 , 
    ASSOCIATED_MEASURE_GROUP =
    'TR Other';
    Scope [Measures].[Kw];
     Scope [Product].[UOM].[kW];
     This = [Measures].[Quantity];
     End
    Scope;
    End
    Scope;
    …and the calculations are solid…with one exception: when I took out UOM from the query there are no more any resuts:
    Product Name    Quantity    Kw
    Total      
    It’s only working
    if using UOM in the query.                         
    I also thought that a
    tulpe might be another solution as:
    ([Measures].[Quantity],[Product].[UOM].&[kW])
    On this last one I’ve got the expected results with one exception: when I use UOM in the query all the other UOM values are listed each one of them
    having the [Kw] measure calculation value.
    Product Name    UOM     Quantity    Kw
    Product 1              Km  
             50           
    Product 2              Kg   
             60
    Product 3              Km 
              25             25
    Product 3              Kg 
               25             25
    Product 3              Kw 
              25             25
    Product 3              L 
    25              25
    Product 3              T 
    25           
      25
    Product 4              L  
                15
    Product 5              T     
             1.5
    Total                                     151.5        
    25
    …and without UOM in the query I have what I’m expected:
    Product Name    Quantity   
    Kw
    Product 1              50           
    Product 2              60
    Product 3               25           
     25
    Product 4              
    15
    Product 5             
     1.5
    Total                       151.5        
    25
     Maybe we can work together to find a solution.
    Thank you,
    Oks

  • Create different hierarchy based on Dimension values

    I have a dimension called period. This dimension is having 4 different types of periods. The period table looks as below. I need to create 4 different hierarchies for these 4 types of periods based on l1 to l5 values. But all these values are in the same
    table. Is it possible in SSAS? If so please let me know how can I do it. 

    If i understand it correctly, you want one hierarchy for one row, then you need to flat the table in the view and then you can create those hierarchy. But it is no different from having one hierarchy with the table you have. your hierarchy is going to look
    like "Priod5"  <- "Priod4" <- "Priod3" <- "Priod2" <- "Priod1". this hierarchy will have all the values. Don't forget to use the composite key for each attribute except key attribute.
    hope this is helpful.
    prajwal kumar potula

  • Using dimension values in calculations of cubes

    hi ,
    I am trying to build a calculated measure using a dimension values like for example
    if a dimension is portfolio
    having values L,X and C values
    and the calculated metrics is like to be calculated only for L and for others it should show 0.
    I created something like this
    sum({[Portfolio Cd].[Portfolio Cd].&[L]},[Measures].[Annual Intr Amt Pl L])
    the problem is that when this metric is drawn to check the values against this dimension it show same values for all the portfolios
    where as it should show 0 for  X and C .
    Can anybody suggest a solution to this .?
    thanks in advance

    Hi,
      Try using a CASE statement in your Calculated measure as shown in below sample
    WITH MEMBER MEasures.SalesAmount
    as
    CASE
    WHEN [Product].[Category].CURRENTMEMBER.MEMBER_CAPTION = "Accessories" THEN SUM([Measures].[Internet Sales Amount])
    ELSE 0
    END
    SELECT [Product].[Category].[Category] ON 1
    ,MEasures.SalesAmount ON 0
    FROM [Adventure Works]
    Best Regards Sorna

  • Aggregation based on dimension

    Hi all,
    Can anyone help me in knowing the difference between normal aggregation set for a measure irrespective of dimensions and different aggregations set for the same measure based on dimension...

    hi User,
    Look at http://oraclebizint.wordpress.com/2007/12/03/oracle-bi-ee-101332-level-based-measures-lbms/
    thanks,
    Saichand.v

  • Dimension value queries

    Hi All,
    I want to write a dimension value query to filter the records based on dimension values. I have a requirement to use the "!=" and "NOT" operators in the EQL query. I know that EQL queries support these operators and it also written in the manual that even dimension value queries support this. In the manual examples are given only for property value queries. I tried to implement the same for dimension value queries but the application did not return any records for that. can anyone help me with an example for dimension value queries for these 2 operators?
    Any help will be appreciated.
    Thanks in advance,
    Sav

    Hi All,
    I want to write a dimension value query to filter the records based on dimension values. I have a requirement to use the "!=" and "NOT" operators in the EQL query. I know that EQL queries support these operators and it also written in the manual that even dimension value queries support this. In the manual examples are given only for property value queries. I tried to implement the same for dimension value queries but the application did not return any records for that. can anyone help me with an example for dimension value queries for these 2 operators?
    Any help will be appreciated.
    Thanks in advance,
    Sav

  • MDX query Help - filtering Measures based on values in a dimension.

    Hi,
    I want to get values of a aggregate measure filtered by value available in Dimension attribute.
    Details:
    We have a Measure called "Average Compliance" which provides an average value over certain dimensions. Now I have some target values available for different attributes.
    Fact Table (there are bunch of other columns in the fact table)
    Id
    TargetId
    InstanceId
    LocationId
    Compliance
    1
    1
    1
    1
    0
    2
    1
    1
    2
    1
    3
    2
    1
    1
    1
    4
    2
    2
    1
    0
    5
    2
    1
    1
    1
    6
    2
    1
    1
    1
    Dimension
    TargetId
    Target Average Compliance
    1
    90
    2
    70
    3
    92
    4
    40
    Now I want to get a query where I can get the "Average Compliance" which is higher then the target average compliance.
    Is this achievable?
    Thanks in advance.

    HI,
    I did give this a try. (replacing the date dimensions.)
    WITH MEMBERMEASURES.mycalc AS
    [Dim Measure].[Target].
    CURRENTMEMBER.MEMBER_KEY
    SELECT
    {[Measures].[Average Compliance],MEASURES.mycalc}
    ON0
    FILTER([Dim Measure].[Target].[Target]
    ,([Measures].[Average Compliance] * 100) <
    --80
    CINT([Dim Measure].[Target].
    CURRENTMEMBER.MEMBER_KEY)
    )*[Dim Measure].[Measure Uri].[Measure Uri]
    ON1
    I am still seeing values for average compliance which are more than the target (I even tried setting the value to be hardcoded to 80 and I still see average compliance of 100
    Thanks

  • Preaggregation across value based hierarchy dimension in 11g

    Hi All,
    I have created a cube with 6 dimensions in olap 11g. One of those six dimensions has only one hierarchy which is value based hierarchy. I have chosen level based aggregation as I know at what levels exactly users are going to query. When I was going through the dimensions to choose levels to preaggregate I noticed there were no options available for my value based hierarchy dimension ( I could see "all" option for the same case in 10g) then I tried to look for definitions of underlying objects just to make sure it will preaggregate data across my value based hierarchy dimension.
    I found value set corresponding to my value based hierarchy dimension in <CUBE NAME>SOLVEAGGMAP object , which AWM uses to decide which dimension values to preaggregate but if I do rpr on that value set (rp r<CUBE NAME>SOLVE<DIMENSION NAME>_PVSET) it shows NA so my question is can I pre aggregate across value based hierarchy dimension in olap 11g?
    Olap Version: 11.2.0.1
    AWM version: 11.2.0.1
    Thanks

    Even if you know exactly which levels your users will query, percent based precompute (e.g. 30%) may still be faster in practice because queries are returned using 'sparse looping' instead of 'dense looping'. This was the single biggest performance advantage of 11g over 10g.
    But if you still want to use level based precompute, then you should look at the XML template for the cube (as saved by AWM, for example). In it you should find something called PrecomputeCondition. This defines the set of members that are precomputed. Here is an example I just created using the GLOBAL schema
    <PrecomputeCondition>
    <![CDATA[
      "TIME" LEVELS ("TIME"."MONTH", "TIME".CALENDAR_QUARTER, "TIME".CALENDAR_YEAR),
      CHANNEL LEVELS (CHANNEL.TOTAL_CHANNEL, CHANNEL.CHANNEL),
      CUSTOMER LEVELS (CUSTOMER.MARKET_SEGMENT, CUSTOMER.REGION, CUSTOMER.SHIP_TO),
      PRODUCT LEVELS (PRODUCT.CLASS, PRODUCT.FAMILY, PRODUCT.ITEM)]]>
    </PrecomputeCondition>The PrecomputeCondition is also visible through the USER_CUBES view.
    SELECT PRECOMPUTE_CONDITION
    FROM USER_CUBES
    WHERE CUBE_NAME = 'MY_CUBE';You can hand modify this condition in the XML to specify an alternative 'non level based' precompute condition for any dimension. For example, if you define an attribute named 'SHOULD_PRECOMPUTE' on your PRODUCT dimension that is 1 for members to be precomputed and 0 for all others, then you can change the condition as follows.
    <PrecomputeCondition>
    <![CDATA[
      "TIME" LEVELS ("TIME"."MONTH", "TIME".CALENDAR_QUARTER, "TIME".CALENDAR_YEAR),
      CHANNEL LEVELS (CHANNEL.TOTAL_CHANNEL, CHANNEL.CHANNEL),
      CUSTOMER LEVELS (CUSTOMER.MARKET_SEGMENT, CUSTOMER.REGION, CUSTOMER.SHIP_TO),
      PRODUCT WHERE PRODUCT.SHOULD_PRECOMPUTE = 1]]>
    </PrecomputeCondition>If you recreate the cube from the XML with this condition, then the PVSET valueset you discovered should contain all dimension members for which the attribute value is 1.   This gives you complete control over what is precomputed.   Note that AWM doesn't support this form of condition, so it won't show up if you go to the Precompute tab, but it is valid for the server.  The PL/SQL below will modify the PrecomputeCondition (for the cube named MYCUBE) without going through AWM.
    begin
      dbms_cube.import_xml(q'!
    <Metadata
      Version="1.3"
      MinimumDatabaseVersion="11.2.0.2">
      <Cube Name="MY_CUBE">
        <Organization>
          <AWCubeOrganization>
            <PrecomputeCondition>
              <![CDATA[
               "TIME" LEVELS ("TIME"."MONTH","TIME".CALENDAR_QUARTER, "TIME".CALENDAR_YEAR),
               CHANNEL LEVELS (CHANNEL.TOTAL_CHANNEL,CHANNEL.CHANNEL),
               CUSTOMER LEVELS (CUSTOMER.MARKET_SEGMENT,CUSTOMER.REGION,CUSTOMER.SHIP_TO),
               PRODUCT WHERE PRODUCT.SHOULD_PRECOMPUTE = 1]]>
            </PrecomputeCondition>
          </AWCubeOrganization>
        </Organization>
      </Cube>
    </Metadata>
    end;
    /

  • Logical column - Fact measure using Dimension value

    Hello all, I have a Fact table that has a metric (Value) where I have set the Aggregation rule to Sum. Now I'd like to create a metric based on the value of a Product Dimension that joins to this Fact table. So I create logical column that has the syntax - Case When Product_Desc = 'A' then Value else 0 End.
    The issue is in Answers when I bring this new metric in it doesn't bring in the correct value, are there steps I am missing with creating this metric?
    My assumption is if I just bring that new metric in by itself it would return one record - A sum of the Value where the Product = 'A'.
    Thank you

    Hi BRizzle,
    In your scenario, you creatre a calculated measure using the employee dimension, and then this measure show "#VALUE" on the pivot table, right? It seems that it's a limitation of using calculated measures in SQL Server Analysis. Calculated measures cannot
    be secured using Dimension Security in a straight forward manner, in fact they won't be listed at all in the Dimension tab of the role where we define the Dimension security. When such measures are browsed in client tools like Excel, the value that would be
    displayed is an error value like #VALUE. For the detail information about it, please see:
    Limitations / Disadvantages of using Calculated Measures / Calculated Members in SSAS
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • SSRS Matrix report to show or hide year column based on parameter value "Date" selected.

    Hey experts!
    I have a requirement an ssrs matrix report should display columns (year/s) based on parameter value (date/s). 
    My Dataset fileds are: Product, Year_name, Month_name, Date
    Currently my report output looks like this-
    Param Date: 2013-08-01 00:00:0.000
    Product +Calender2011      +Calender2012     -Calender 2013........                        +Calender2014
                             Total
                      Total Jan13  Feb 13  Mar13..  Dec13   Total           Total
    Abc                      100
                        220
    10      20         30.......  20       250              400
    Xyz 110
    200 50      80         40.......  30       450              600
    My requirement:  if I'm selecting Date parameter value as '2013-xx-xx' I should only able to see Year column 'Calender2013' and rest of the years should hide. Similarly If I'm selecting Date parameter value as '2014-xx-xx' I should only able to
    see Year column 'Calender2014' .
    Appreciate your kindly help. 
    Afan

    Hi Afan,
    According to your description, you want to only show the selected year on your report, right?
    In this case, you need to get the year from the date parameter using the expression below
    =Year(Parameters!Date.Value)
    And then use the expression below to get the year from Year_Name field.
    =Right(Fields!Year_Name.Value,4)
    Then add a filter to the dataset to filter the data like below
    Expression:=Year(Parameters!Date.Value)
    Operator:=
    Value:=Right(Fields!Year_Name.Value,4)
    Reference
    http://msdn.microsoft.com/en-IN/library/dd255287.aspx
    If you have any questions, please feel free to ask.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to control the measure based on the related dimension.

    Hi Experts,
    In order to improve performance, I have created three kinds of time tables in DB,such as Year .Month, Day.
    Then import them into the physical layer in RPD, and combine them into one dimension in BMM.
    Actually, it has three level fact related with three time tables,so they are also dragged into one fact in BMM,and one column will be corresponding with three column derived from different Fact table in physical layer.
    So I want to know how to control the measure based on the related dimension.
    For example:
    when users drag the Year,Sales column, it will come from Year Dimension and Year Fact Table.
    when users drag the Month,Sales column, it will come from Month Dimension and Month Fact Table.
    when users drag the Day,Sales column, it will come from Day Dimension and Day Fact Table.

    Hi,
    Create a dimension Hierarchy, with Year >> Month >> Day Levels and
    Next Double click on Year Table LTS >> click on Ocntetnt Tab >> set as Year
    same way for Month LTS and Day LTS.
    So now when you select year column then server canknow which LTS to hit and Hits Year LTS.
    Mark If Helpfu/correct
    Thanks.

  • Calculate a measure depending on the value of other dimension

    HI,
    I would like to know if it’s possible to calculate a measure depending on the value of other dimension. I want to calculate this measure in the Business Model and Mapping. I show you how I am trying to do it:
    http://img338.imageshack.us/img338/2496/imagenjp.png
    But when I try to make an aggregation of this measure then I get an error of consistency.
    I think a good example to make you to understand me is the function TODATE which calculates an aggregation depending on one time dimension. I would like to do the same thing but regarding to the value of other dimension.
    Can someone help me? Thanks a lot.

    Hi,
    Do you have that dimension table as a "Sources" in that BMM folder? if yes, then you can use the "Data Type" option and click on "show all logical sources". Then click on your fact table using which you want to do the calculation and then use this formula. After that you can have the aggregation.
    It should work.
    Thanks,
    Rohit

  • Need a measure variable based on dimension

    Dear Experts,
    I  need a variable based on dimension.This should gives the values from 1 to n based on dimension.
    Suppose i have a column "Wage type".If it has 10 rows,Then for first one it should be 1 and second one it should be 2 and so on.I want to implement break for this dimension,even though the variable should give same values as i mentioned above.
    I try to use RowIndex and Count functions.But i couldnt get my requirement.
    I want to use this values in Xcelsius.
    I hope you can understand issue.
    Regards
    Venkat
    Edited by: Venkat8130 on Jun 23, 2011 7:24 AM

    Hi,
    I worked on the same issue, in my case result in following format
    year........count...month......revenue
    2001........ 1........ jan............100
    .................2.........feb............200
    .................3......... mar...........300
    .................4......... apr............400
    2002.........1...........jan..........500
    .................2..........feb...........600
    .................3..........mar..........700
    If you are expecting the same format, first break the report deportment wise. Create the variable count with bellow formula.
    =RunningCount([Month];Break)
    Regards,
    Shahin.
    Edited by: shahin13 on Jul 19, 2011 8:58 AM
    Edited by: shahin13 on Jul 19, 2011 9:04 AM

  • Tutorial for "aggregate based on dimensions"?

    Hi, has anyone seen a detailed, step by step explanation of how to use the "aggregate based on dimensions" functionality? I easily understand how this is used in "time based" examples - i.e. average balances over time, beginning and ending balances, etc.
    However, I'm thinking I may be able to use this to solve a problem I have where I need to average employee ages - but because employees can have more than one job, their ages often show up more than once (which I don't want). Somehow it seems like I should be able to use the FIRST or LAST aggregation function on one and/or some of the dimensions to achieve what I want...but I'm a bit stumped on how.
    Thanks in advance!
    Scott

    I believe you want to use the FILTER function:
    FILTER("Auto AR".UBI_AUTO_AR.PATIENT_AR USING "Auto AR"."UBI_AUTO_AR"."YEAR_MONTH" = last("Auto AR"."UBI_AUTO_AR"."YEAR_MONTH" ) )
    I am not positive that it will work with the last() function, but it is worth a shot. This will aggregate based on the aggregation setting for "Auto AR".UBI_AUTO_AR.PATIENT_AR.

  • AWM Set Aggregation Operator based on Measure instead of Dimension?

    Is there anyway to base an operator of a measure over a dimension on the measure instead of the dimension? In AWM, I notice that each Measure has an Aggregation tab that summarizes its operator over each dimension, but it is greyed out. The way I'd like it to work is to have one Measure be summed over the Dimensions, while another Measure is averaged over the Dimensions.

    Found my answer: Not only do I need to make sure my cube is not compressed, but I also need to select "Override the Aggregation specification of the cube" under each Measure's General tab. This results in the contents of the Aggregation tab no longer being grayed out.

Maybe you are looking for

  • GPU not allowing TV connection

    I have an MSi nvidia n570gtx twin frozr ii and I am trying to connect my tv to it. I tried the VGA cable with a dvi adapter that came with my monitor, and that worked but did not go to full screen. So I bought a dvi to hdmi adapter to try to get full

  • Unable to open file in ME23N.

    Dear All, My requirement is to upload file into ME23N transaction using program. User will upload file from desktop, file is stored in service for object in the transaction, But if we open the file, it display error message u201Cunable to open fileu2

  • Locked Folder

    Why is it that after I select the "Write only(Dropbox)" option when locking a folder, I receive the following message when I try to open it..."You do not have permission to open the document "<<folder name>>". Contact your computer or network adminis

  • How do I change my default browser on my MBP back to Safari?

    I made the mistake of changing my default browser to Google Chrome on my MBP. I have it on my Dad's Dell, only cause I updated that to Windows 7 and needed to update the browser settings on that. That change on my MBP transfered the Norton & MaFee as

  • WebDynpro for Java: Standard Components for SM02 en rrMX?

    Hi, Are there standard Components WebDynpro for Java for the transaction codes SM02(SM02_READ_MESSAGES) and RRMX(?)? Which Business Package do i have to use? Kind regards, Joris Meeuwsen