mdx

Two independent measures based on two time hierarchies

人盡茶涼 提交于 2019-12-25 04:17:13
问题 I've got a simple cube with a fact table which has a date field among others and connected it with a time dimension which has 2 hierarchies. What I want to do is create one measure that will be filtered only by the one time hierarchy and a second one for the second time hierarchy. Basically this: Measure1 ----> Cannot be affected by filtering of time_hierarchy2 and gets filtered only by time_hierarchy1 And the same for Measure2. With what I've tried so far I can't do this because whenever I

MDX query: How to compare year to date figures from the current year with year to date figures from the previous year?

元气小坏坏 提交于 2019-12-25 03:53:26
问题 With the below MDX queries I am attempting to return a comparison of sales figures. I want to compare YTD with LYTD, defined as follows: YTD: 01 Jan this year (01/Jan/2011) until today (17/Aug/2011) LYTD: 01 Jan last year (01/Jan/2010) until today's date last year (17/Aug/2010) Both periods should contain the same number of days (give or take one day for leap years). So far I have tried using the YTD() function to get this year's data but I have not had much success with wrapping the YTD()

MDX query to count number of product names

…衆ロ難τιáo~ 提交于 2019-12-25 03:44:42
问题 I am new to MDX and trying to count number of product names on a week basis. I have written the below MDX query, but I get all product count as a result. WITH MEMBER [Measures].[Count Of Members] AS Count(Existing [Product Dimension].[ProductName].Members) SELECT {[Measures].[Count Of Members]} ON 0, NON EMPTY { [Date Dimension].[Financial WC] } ON 1 FROM [Cube] WHERE ([Date Dimension].[FinancialYear].&[2018/19], [Sales].[PaymentType].&[Delivery]) I am getting result as : "All 230" as there

Previous Equivalent MTD Across Multiple Months

◇◆丶佛笑我妖孽 提交于 2019-12-25 03:41:08
问题 If today's date is 11 July 2008 then the MTD sum is for the range {01 July 2008 - 11 July 2008}. The previous equivalent MTD period in June is {01 June 2008 - 11 June 2008}. The previous equivalent MTD period in May is {01 May 2008 - 11 May 2008}. I have the following MDX script: WITH MEMBER [Measures].[PrevEquivalentMTD] AS //SUM ( ParallelPeriod ( [Date].[Calendar].[Month] ,1 ,[Date].[Calendar].CurrentMember ) ,[Measures].[Internet Sales Amount] ) MEMBER [Measures].[PrevEquivalentMTD_v2] AS

How to multiply two measures prior to aggregation

浪子不回头ぞ 提交于 2019-12-25 03:27:25
问题 I have two measures. The first is amount, and the second consist of values -1,0 and 1, so table looks like this: Amount Sign -------------- 400 -1 200 1 300 0 Result I want to get is 400*(-1) + 200*1 + 300*0 = -200 , but I am getting (400+200+300)*(-1+1+0) = 0 This is my calculated member: WITH MEMBER [Measures].[Result] AS [Measures].[Sign]*[Measures].[Amount] select [Measures].[Result] on 0, [Time].[Time].members on 1 from [MyCube] 回答1: In you SSAS project, go to the datasource view, for

Calculated Members with multiple Attribute Hierarchy - MDX

瘦欲@ 提交于 2019-12-25 03:27:13
问题 I found this little code where it dynamically calculates TOTAL s for all Dimension/Hierarchy I want. This is close to what I need but will not work for Dimensions that have different number of Hierarchy Levels (Attribute Hierarchy). Current Code only works if there is only one Attribute Hierarchy because of CurrentMember.Parent . I could use CurrentMember.Parent.Parent for Dimension.Hierarchy that have two levels and so on but would not work for the the ones with only one Attribute Hierarchy

Grouping MDX query results

三世轮回 提交于 2019-12-25 02:57:20
问题 I have a following query (based on sample data provided with Microsoft® SQL Server® 2008 MDX Step by Step book): WITH SET important_months AS { ([Product].[Product Categories].[Subcategory].&[28].CHILDREN , {[Date].[Month of Year].&[1], [Date].[Month of Year].&[2]}), ([Product].[Product Categories].[Product].&[477] , {[Date].[Month of Year].&[3]}) } SELECT [Measures].[Order Count] ON COLUMNS, important_months ON ROWS FROM [Step-by-Step] The query shows the number of orders placed on products

How to Apply group by on mdx Query

拈花ヽ惹草 提交于 2019-12-25 00:50:01
问题 Working pentaho dashboard trying to generate report to get transaction count per day/Week/Month between two date. Below MDX Query return transaction count 1 because 'created' is not group by WITH SET [~COLUMNS] AS Filter([created].DefaultMember.Children, [created].CurrentMember.name >= "2014-10-01" AND Left([created].CurrentMember.Name, 10) <= "2014-10-02") SET [~ROWS] AS {[markup].[markup].Members} SELECT NON EMPTY CrossJoin([~COLUMNS], {[Measures].[Transaction Count]}) ON COLUMNS, NON EMPTY

MDX - Cumulative Sum Not working when selecting multiple dates

拜拜、爱过 提交于 2019-12-24 21:16:56
问题 I've build an MDX calculated member that returns the Cumulative Sales over time. - the query returns correct results if no filters applied or the user filters with 1 month my problem is that when the user selects multiple months the query returns the cumulative for the whole year here is what i wrote using Dynamic Set, Calculated Member and Scope: Dynamic Set: PeriodToDate = EXISTING PeriodsToDate([Date].[Calendar - YQMD].[Year],[Date].[Calendar - YQMD].CurrentMember) Calculated Member: (

Merging two tuples in the same hierarchy into one (in MDX WITH SET command)

烂漫一生 提交于 2019-12-24 20:26:45
问题 The following MDX query returns measure X on 3 tuples: 2001, 2002-1 and 2002-2. What I am trying to do is merging 2002-1 and 2002-2 into one tuple and have the measure X for 2001 and 2002-1&2. Using SUM function is not possible. Because measure X is used on other axis. with member v as [Measures].[X] set w as {[Dim Date].[Calendar Date].[Year].&[2001], [Dim Date].[Calendar Date].[Month].&[1]&[2002], [Dim Date].[Calendar Date].[Month].&[2]&[2002]} select w on 0, v on 1 from [DS]; 回答1: You can