.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Rollup calculated measure at aggregate measure and only apply calculation at leaf

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :


I have the following calculated measure: MeasureX = MeasureA * MeasureB.


I only want the calculation to apply at the leaf level, then the answer should rollup automatically to higher levels.


So instead of Sum(MeasureA) + sum(MeasureB). I need sum(MeasureX)


The solutions I've found for this issue, refer to the relational engine to solve the problem: etl/dsv/calc column.

But I need it to be solved in the cube.




MCITP BI Developer 2008 - MCTS SQL Server 2005

View Complete Post

More Related Resource Links

How to get calculated measure to rollup correctly?



I have created a calculated measure that computes a weighted ratio for the current balance of all loans that fall into various risk ratings:


    MEMBER [MEASURES].[Weighted Ratio] AS

     (Measures.[Current Balance] * [Risk Rating].[Loan Rating Code].CurrentMember.member_value) / 


          [Measures].[Current Balance],

             Ancestor([Risk Rating].[Loan Rating Code].CurrentMember, 1)

     ), FORMAT_STRING = "Standard"


     {[Measures].[Current Balance], [Measures].[Weighted Ratio]} on COLUMNS,

     [Risk Rating].[Loan Rating Code].MEMBERS ON ROWS


     [Test Cube]


The problem is that the results come back only at the child level, instead of being summed up:


         Current Balance     Weighted R

Measure Dependent Calculated Measure

Hi Was looking to create a calculated Measure Which needs to be dependent on another column of the FACT table. I need to have the Average of the particular Measure based on the fact that this particular 'set' has a common Related dimension's The example would give a better picture. I have a set of dimensions like STUDENT, TEACHER, COURSE etc as my dimensions and the grades, class standing based on marks for the subject, percentage of marks scored, Percentile, Marks Scored,StudentID and the related PK's etc are the measures on my fact table Here I want the Avg of the marks scored by the Students based on the grade say is  A or B or C  I was looking to create a calculated measure by using MDX which was a follows (NOT THE CORRECT SYNTAX JUST THE IDEA) SUM  (MARKS SCORED)/COUNT(DISTINCT StudentID) WHERE GRADE = A As this would be measured against a particular subject or a teacher or a Course. I was hoping if I could get help in putting this in a proper SYNATAX   Thanks in advance.  

Please help with converting calculated measure.

Hi, I have to dimensions: [Currency] with members CAD and USD and [Convet to] with members None, CAD, USD. The measures involved in calculation are [Amount Billed] and [Amount Received] The problem calculation is defined pretty simple: MEMBER CURRENTCUBE.[Measures].[AR] AS (abs([Measures].[Amount Billed] - [Measures].[Amount Received])>0.1,[Measures].[Amount Billed] - [Measures].[Amount Received] ,null); and worked perfect without currency conversion . I've read some info about currency conversion and designed this calculation to convert: scope (leaves([Time 2])); scope([Convert To].[Convert To].&[USD],[Currency].[Currency].&[CAD]); [Measures].[Amount Received] = ([Measures].[Amount Received],[Convert To].[Convert To].&[None])/validmeasure([Measures].[Cdrate]); [Measures].[Amount Billed] = ([Measures].[Amount Billed],[Convert To].[Convert To].&[None])/validmeasure([Measures].[Cdrate]); End Scope; scope([Convert To].[Convert To].&[CAD],[Currency].[Currency].&[USD]); [Measures].[Amount Received] = ([Measures].[Amount Received],[Convert To].[Convert To].&[None])*validmeasure([Measures].[Cdrate]); [Measures].[Amount Billed] = ([Measures].[Amount Billed],[Convert To].[Convert To].&[None])*validmeasure([Measures].[Cdrate]); End Scope; End Scope; That calculation provides correct results for both [Amount Billed] and [Amount

Optimize Calculated Measure containing COUNT EXISTING

Hi, My goal is to change the text color of all cells that contain aggregated values. Currently I achieve it like this: I COUNT the members of all attributes of all dimensions. To be multi-select-safe I am using the EXISTING keyword. If the members count of at least one dimension is not 1 than the background color of the cell is changed. CREATE MEMBER CURRENTCUBE .[Measures].[SingleCellSelected]   AS iif ((COUNT (Existing ([Dim1].[Attr1].[ Attr1].MEMBERS ))=1) AND (COUNT (Existing ([Dim1].[Attr2].[Attr2].MEMBERS ))=1) AND (COUNT (Existing ([Dim2].[Attr3].[Attr3].MEMBERS ))=1) AND (COUNT (Existing ([Dim2].[Attr4].[Attr4].MEMBERS ))=1) AND (COUNT (Existing ([Dim3].[Attr5].[Attr5].MEMBERS ))=1),1,0),   VISIBLE = 0  ;    SCOPE ([Measures].AllMembers ); FORE_COLOR (this ) = iif ([Measures].[SingleCellSelected]=1,0,16744448); END SCOPE ; This approach works but it performs badly with attributes with many members. Do you have any idea how to optimize this? Thank you!

Help about cascadin M2M with parent child hierachy custom rollup for one measure

Dear MSAS Experts, My name is Andre and i am writing my thesis about data quality which needs to be finished in about 3 weeks.:-( For my thesis i needed to develop a Schema which store data quality issues. This is a part of my schema which includes a cascading M2M: Facttabele: ErrorFact / ChecksFact / RULE ID / ... DT_RULE: Rule_ID / ..... RULE_ATTRIBUTE_BRIDGE: RULE_ID / Attribut_ID => M2M beetween Rule and Attribut(Rules can belong to multiple Attributes) DT_Attribut: Attribut_ID / .... Attribut_KPI_Bridge: Atribute_ID / KPI_ID => M2M beetween Attribute and KPI (Attributes can be used for multible KPI calc) DT_KPI: KPI_ID, KPI_Name, KPI_PARENT => Parent Child Since MSAS do not provide a Agrgatefunction I have a calculated Measure (lets say its called 'EC') which calculates the average of ErrorFact/ChecksFact. Now the problem I do have is that the 'EC' Measure should be aggregated within and only in the DT_KPI dimension that every child which belongs to the same parent should be muliplicated ('*') with each other till we reach the all member node. So if we have the following PC-Hierachy: -A --B ---C ---D --E The result of A would be (C*D)*E = A. B of course would show the result of C*D. On the other hand all the other facts should use the normal aggregation for this dimension. Also EC should be aggregated normal in all other dimensions. I tried usin

Calculated measure between two dates

Following fact table - Amount - StartDate - EndDate - SomeOtherDate   If the user selects a date in the time dimension I want to build the sum of Amount where the selected date is between StartDate and EndDate. Like this   SELECT SUM(Amount) WHERE <date> between StartDate and EndDate   Is it possible to create a calculated measure like this.   Thanks.

Advise on calculation of measure of Balance sheet account

I am building a cube on top of Navision. The transaction table contains all transactions since the start with Navision (1 July 2003) on General Ledger Account level. For the Balance Sheet accounts, we have imported/inserted opening balance amounts. For the calculation of a trial balance of the Profit and Loss accounts I can just SUM the transactions for the period and it gives me the result for the period. For the balance sheet however, I can only calculate the net change for the period but not the ending balance for that period. Does SSAS have some kind of function to calculation the amount since the first date entry? (in my case 1 July 2003) For the P&L for example I created a calculated measure by using the YTD function that gives me the SUM for January untill August, even if I have selected only the month of August. It would be nice if SSAS had some kind of STD (start to date) function. Or do you advise that I have SSIS insert an opening balance on 1 January for each General balance sheet account (if I would find out how to do that ;-)

Measure value that ignores custom rollup formula

I have dimension with parent-child defined and I also have customrollupcolumn set for the parent. I have a measure which I need to get WITHOUT customrollup formula affecting the value. Any help is appreciated. Thanks

Which version of Excel to install for a calculated measure?

I have a 64bit server running SSAS 2010 and I keep getting an ExcelMDX error when processing my cube. We do use an Excel function called FINV() in a calculated measure. I installed Excel 2007 on the SSAS 2010 server but this did not help (I also tried Excel 2010). I can start Excel on the server so I know it is installed. Does it matter whether I install Excel 32bit or 64bit on the server? How do I verify that Excel is installed correctly for SSAS 2010? Errors and Warnings from Response  MdxScript(Sales and Returns) (94, 8) The '[Excel].[FINV]' function does not exist.Kerry

Calculated Measure Help - Comparing Months from two Date Dimensions

Hello:   I have a Measure Group that has two Date dimensions, a Reporting Date and a Fee Paid Date. The Reporting Date and the Fee date is based on the same Dimension, which has a standard YQMD hierarchy. It's very typical. The calculation is called "Fees Paid In Same Period", and it would display the Fees paid if the Reporting Month equals the Fees Paid Month.   How do i do this?   Thanks,

Calculated Measure scenario with a filtered dimensional attribute

I have a cube with a Measure (A) and a dimension (C).  I've created a Calculated Measure (B) whose tuple is Measure A with the all member of Dimension C.  The Calculated Measure looks like this: ([Measures].[A], [C].[ALL]) Scenario 1 When I place the dimension on a pivot table, the Calculated Measure B reflects the correct value, Measure A by all members of dimension C. Scenario 2 When I place the dimension in the filter area and filter by one or more members, the Calculated Measure B reflects the correct value, Measure A by all members of dimension C.  The same answer as Scenario 1. Scenario 3 When I place the dimension in the pivot table AND filter by one or more members, I am getting a different answer than I want.  It is filtering first by the members selected and then reflecting the Calculated Measure as the All value of ONLY the selected filter members.  I want the calculated Measure to reflect Measure A by all members of dimension C.  (The same number as in the first two scenarios)   Is there any way to create the Calculated Measure differently so that all three scenarios give me the same answer?  

cummulative calculated measure


HI Guys

i have time Dimemsion and hiriarchy as Year-month-week-day

i have a account Dimension 

Actual as measure

i want to create a Calculated measure for Balance Account which is an member in account dimension

i want to create a calculated Cumulative measure for balance sheet account like the below

which should give me sum of cumulative of actual amounts for Required period


Time                           FY2010-Period1      FY2010-Period2      FY2010-Period3

Balance Sheet                  $2000                      2100                  4100  

the above will calculate the Balance of previous month + current month so on

i hope i am making sense

Kind Regards



Please Help with Defining Calculated Measure based on Dimension Members



The issue looks pretty simple yet I got stuck. I want to define the measure [NR Var] as [NR]-[F NR] for years/months/dates before 2009 and [NR]-[FI NR] for 2009 and on. I am using [Year]-[Month]-[Date] hierarchies in the cube. I have defined scope:

Scope ([Measures].[NR Var], {
descendants([Date].[Year - Month - Date].[Year].&[2004], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2005], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2006], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2007], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2008], 2, self_before_after)});
this=[NR]-[F NR];
End Scope;

but it does not work for some reason. If I get rid of DESCENDANTS function, it works but applies the scope only to the YEAR level. Another problem with using SCOPE is that it affects [NR Var] only yet I have other calcs derivative of [NR Var] which I want the scope to affect as well.

So I ideally I would like to have something like:



case when {
descendants([Date].[Year - Month - Date].[Year].&[2004], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2005], 2, self_befor

Calculated measure that works across multiple hierarchies

Dear all,

I need to create a calculated measure for YTD that dynamically calculates based on the date hierarchy selected by the user (SSRS & Excel).

On the date dimension, I have 2 hierarchies "Year-Month-Day" and "Year-Week-Day", that both share the year and day attributes.

What's the best way to go about this?

Many thanks,


Creating a calculated measure that filters



Can I create a calculated member that will filter out based on a certain dimension? eg, I have a customer dimension and a sales cube. The sales cube has the sales count measure. Can I have a calculated measure that will give me the sales count for all customers that are flagged as 'New'?  That way, I have a total count and a New customer count.



Problem with a calculated measure that works across different time hierarchies.


I was inspired to create a calculated measure which works with all available time hierarchies after reading this original post.


I created   a calculated measure called ‘Selected Hierarchy’ as follow which returns either ‘Admit’, ‘Received’ or ‘Discharge’ as the hierarchy is selected.


when NOT IsError(Extract ( Axis (0), [Admit Date].[Date Hierarchy]).Count ) then 'Admit'

mdx calculated measure sum of sick duration for all sick cases ended in period T



I'm using SQL server 2008 standard edition.

I have a cube with measure groep sickness, and dimensions date and employee.

In the sickness fact table i have employeeID, sick ID, sick start date, sick end date. The employeeID is linked to employee dimension, and both the sick start date and end date are linked to the date dimension.

Now i want to create a calculated measure, which calculates the sum of the duration of all sick cases that ended in period t.

So that I later can create a report with on one axis the period (months) and on the other axes the sum of the duration of all sick cases ended in that month.

I already have a measure which counts sick duration. But how can I add the condition that it only takes the sick cases ended in a period?

Regards, Hennie



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend