mdx

MTD without using the MTD function

不想你离开。 提交于 2019-12-13 02:57:02
问题 This is our current MTD calculation: MEMBER [Time Calculations].[Time Calculations].[Calculate MTD] AS Sum ( MTD([Date].[Date - Calendar Month].CurrentMember) ,[Time Calculations].[Time Calculations].[Current Value] ) I've seen somewhere along the way a MTD calculation that uses the range operator : . The following will be a sum from the start of time: MEMBER [Time Calculations].[Time Calculations].[Calculate MTD] AS Sum ( null: [Date].[Date - Calendar Month].CurrentMember ,[Time Calculations

Changing a date format to a shorter date

拜拜、爱过 提交于 2019-12-13 00:35:40
问题 We've got the following script: WITH SET [Last56Days] as TAIL ( [Date].[Date - Calendar Month].[Calendar Day].members, 56 ) MEMBER [Measures].[DateValue] as [Date].[Date - Calendar Month].CURRENTMEMBER.member_value, format_string = "short date" MEMBER [Measures].[DateValue2] as [Date].[Date - Calendar Month].CURRENTMEMBER.member_value, format_string = "dd/mm/yyyy" SELECT { [Measures].[DateValue], [Measures].[DateValue2]} ON COLUMNS, Hierarchize ({ [Last56Days] } ) ON ROWS FROM [Our Cube] It

MDX return last month of every year

守給你的承諾、 提交于 2019-12-13 00:25:50
问题 I am trying to create a set to return the value of the last month that contains data for each year. For example if I would put year on the rows 2011,2012,2013,2014 would all contain data for December. 2015 would contain data for June of 2015. I can't seem to get anything but the latest month to return. I figure it is because of my tail statement, but I'm not sure how to fix it. CREATE SET [Last Statement Month] AS Tail( nonempty( Descendants( [Date].[Calendar].currentmember ,[Date].[Calendar]

Excel Filter a CUBESET with Slicers

浪子不回头ぞ 提交于 2019-12-13 00:12:03
问题 Basically, I am trying to filter the results of a CUBESET function in Excel according to a slicer, and I'm not really getting anywhere. I have a two-column table of clients and the state they belong to, and a slicer of states that the user can filter with. There are some other parts of the sheet where I want to display all of the clients in the selected state in the cells, so I'm hoping to use CUBERANKEDMEMBER with a CUBESET that is filtered by the slicer. For a basic case where I hard code a

MDX permission error when I call a table in SQL Server instance

早过忘川 提交于 2019-12-12 23:25:39
问题 I am trying to execute this query in MDX INSERT INTO MINING STRUCTURE [People1] ([CustID], [Name], [Gender], [Age], [CarMake],[CarModel]) OPENQUERY(Chapter3Data, 'SELECT [Key], Name, Gender, Age, CarMake, CarModel FROM People') I have a database Chapter3Data with people table in my SQL Server instance, but I get this error : Executing the query ... Either the 'Ehsan\ehsan akbar' user does not have permission to access the 'Chapter3Data' object, or the object does not exist. Execution complete

Test if a set exists before trying to drop it

心已入冬 提交于 2019-12-12 19:40:22
问题 In SQL before dropping a table I will check if it exists first so as not to cause an error, like so: IF OBJECT_ID('TEMPDB..#table') IS NOT NULL BEGIN DROP TABLE #table END In MDX I could do with a way of checking if a set or member already exists before trying to drop it. Currently I have the following stucture within some of my .mdx files. I add a custom set to the cube and then use that set in several scripts that follow i.e. they are mult-batch scripts. /* //I run the following manually...

How can I write an mdx query that slices by both a date range and dimension member value

风格不统一 提交于 2019-12-12 18:01:38
问题 I need to write an mdx query that limits its results by the value of a dimension but also by a date range. I know how to do one or the other but I can't figure out how to do both at once. This works for the date range: SELECT {[Measures].[Hours]} ON COLUMNS, [Time Type].[Type].Members ON ROWS FROM [cube] WHERE {[Date].[Date ISO].[2013-01-26]:[Date].[Date ISO].[2013-06-25]} And this works for the member slicer: SELECT {[Measures].[Hours]} ON COLUMNS, [Time Type].[Type].Members ON ROWS FROM

MDX DRILLTHROUGH Fails but select can be successfully executed

两盒软妹~` 提交于 2019-12-12 14:18:59
问题 I have the following MDX query which succesfully returns the measure when executed - SELECT {[Measures].[Closed Quote OE Retail]} ON COLUMNS FROM Sales WHERE ( [Posting Date].[Date YQMD].[Month].&[11]&[2012] ,[Work Provider].[Code].[LV] ,EXCEPT([Item].[by Item Category by Product Group].[Item Category], [Item].[by Item Category by Product Group].[Item Category].&[OEM]) ,EXCEPT([Lost Sale Reason Code].[Code].[Code], [Lost Sale Reason Code].[Code].[All Lost Sale Reason Code].UNKNOWNMEMBER)

MDX How to retrieve data based on the latest date

风流意气都作罢 提交于 2019-12-12 06:17:05
问题 How to retrieve data based on the latest date for that particular record only. SELECT [Measures].[Assessment Patients Detail] ON COLUMNS ,NON EMPTY ( [DimAssessment].[Assessment Text].&[Employee Wellness HRA] ,[DimAssessment].[Question Text].&[Do you use tobacco products?] ,[DimPatient].[Patient Key].[Patient Key] ,Generate ( [DimAssessment].[Answer Text].[Answer Text].MEMBERS , [DimAssessment].[Answer Text].CurrentMember * Tail ( NonEmpty ( [DimDate].[Full Date Alternate Key].[Full Date

How to get Last Selling Price in MDX

99封情书 提交于 2019-12-12 05:28:08
问题 Can MDX return the Expected Result as per code below? Have the data as per below : DATA: ItemID DateKey Price A 20151230 4.85 A 20150520 5.5 A 20150325 4.65 B 20140130 3 B 20141130 5 B 20150630 4.5 Wrong Result: ItemID DateKey Price A 20151230 4.65 B 20150630 3 Expected Result: ItemID DateKey Price A 20151230 4.85 B 20150630 4.5 WITH MEMBER [LastDate] AS tail (Filter([BI Dim Date].[Date Key].[Date Key],[Measures].[PRICE])).Item(0).name MEMBER [LastDateWithSales] AS Filter([MyTest].[PRICE].