More dimensions on rows
Let’s add a second dimension to our query:SELECT { [Measures].[Sales Amount] } ON COLUMNS , NON EMPTY { [Date].[Calendar Year].Children , [Product].[Product Model...
View ArticleMDX using member
The member function in MDX is comparable with the MS-SQL CTE functionality. It allows you to define a member before you use it in your query and thus keeping your query more readable.An example:WITH...
View ArticlePREVMEMBER and NEXTMEMBER
The PREVMEMBER functionality will give you the previous member on the same hierarchy level. 1-JAN-2011 ==> 31-DEC-2010, 2-JAN-2011 ==> 1-JAN-2011, CY 2011 ==> CY 2010.The NEXTMEMBER...
View ArticleLAG an LEAD
The LAG and LEAD functionality allow to jump back or forward a number of step on the same hierarchy level. LAG(1) and LEAD(1) is the same as PrevMember and Next Member.WITH MEMBER [Measures].[Previous...
View ArticleParent, FirstChild and LastChild
Using the Parent functionality you can get the First Child and Last Child within hierarchy level. 15-JAN-2011 ==> Parent = JAN-2011 ==> FirstChild = 1-JAN-2011 ==> LastChild = 31-JAN-2011.Here...
View ArticleAllMembers vs Children
Both do what their name implies . AllMembers will return All Members on the current level and all levels below.SELECT { ([Date].[Calendar Year].&[2013], [Measures].[Sales Amount])...
View ArticleAncestor
The Ancestor functionality allows us to find, parents, grand parents, great grand parents etc.… The number of levels you want to go up can be a number or a dedicated level. The Ancestor with a level of...
View ArticleAscendants
The Ascendants functionality gives back all levels from and including the current level.SELECT Measures.[Sales Amount] ON COLUMNS, Order( Ascendants( [Product].[Product...
View ArticleDescendants
The Descendants functionality although in name de reverse of the Ascendants functionality has a lot more options.Before you read on just a reminder the Geography hierarchy in the Adventure Works sample...
View ArticleCousin
The Cousin functionality will get you the member on same position as the starting based on a new toplevel member. Most of the time you use it in the same way you use ParallelPeriod.If you look at a...
View ArticleExcept
The Except functionality is of the three Venn Collection functionality's (EXCEPT, INTERSECT, UNION). Except will give all the members of SET1 which are not in SET2. By default it will remove any...
View ArticleIntersect
The Intersect functionality is of the three Venn Collection functionality's (EXCEPT, INTERSECT, UNION).Intersect will give all the members of SET1 which are also in SET2. By default it will remove any...
View ArticleUNION
The UNION functionality is of the three Venn Collection functionality's (EXCEPT, INTERSECT, UNION).UNION will give all the members of SET1,SET2…. SETn. By default it will remove any duplicates.SELECT...
View ArticleRANGE
The Range functionality allows you to define a set of member based on the first and last member of the range. You do this by using the colon “:”.Fixed Range:SELECT [Date].[Calendar Year].[CY...
View ArticlePercentage of one level up
One of the most common calculations is calculating the percentage of the current value to the total one level up. For instance [Measures].[Sales Amount] for the quarter compared to the semester.This...
View ArticleParallelPeriod
The ParallelPeriod functionality is closely related to the Cousin functionality. The main difference is that the ParallelPeriod function expects a hierarchy of the type Time.It will get you the value...
View ArticlePercentage difference from previous parallel period
Let’s start by getting the parallel period:WITH MEMBER [Measures].[Sales Amount PY]AS( [Measures].[Sales Amount] , ParallelPeriod ([Date].[Calendar].[Calendar Year] // Level , 1 //...
View ArticlePeriodsToDate, YearToDate (YTD), QuarterToDate (QTD), MonthToDate (MTD),...
PeriodsToDate, YearToDate (YTD), QuarterToDate (QTD), MonthToDate (MTD), WeekToDate (WTD) are all MDX functions which aggregate date from de first date of a chosen period up and an including a given...
View ArticleYearToDate (YTD) Previous Year (also QTD, MTD, WTD)
This is simple is you combine ParallelPeriod with the YTD functionality:WITH MEMBER [Measures].[Sales Amount YearToDate]AS SUM(YTD( [Date].[Calendar].CurrentMember),[Measures].[Sales Amount])MEMBER...
View ArticleCalculating Median and Percentile
MEDIAN or 50th PercentileAccording to Wikipedia the median or 50th percentile is the numerical value separating the higher half of a data sample, a population, or a probability distribution, from the...
View ArticleCASE WHEN and NULL / 0 (zero)
When you have a CASE WHEN in MDX you basically have two options:The Simple or Searched statement:CASE [<<Set To Be Evaluated>>] WHEN [<<condition1>>] THEN...
View ArticleCalculating an Age
One of the questions you often get is how to calculate a customers age on a certain date. Luckily Chris Webb published a great example:...
View ArticleABC Classification
I was asked to make a simple ABC classification for a sales measures. I combined exists with TopPercent to identify:Class A = between the top 0 and 20 %Class B = between the top 20 and 80%Class C =...
View Articlemultiple first day of week
Nice trick:http://richardlees.blogspot.nl/2015/08/supporting-multiple-first-day-of-week.html
View ArticlePast 12 months dynamic
{StrToMember("[Kalender].[J4MND].[Jaar 4MND Maand].&["+Format(DATEADD("M",-1,now()),"yyyyMM")+ "]").Lag(11):StrToMember("[Kalender].[J4MND].[Jaar 4MND...
View Article
More Pages to Explore .....