Quantcast
Channel: MDX101
Browsing latest articles
Browse All 26 View Live

Image may be NSFW.
Clik here to view.

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 Article



Image may be NSFW.
Clik here to view.

MDX 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 Article

Image may be NSFW.
Clik here to view.

PREVMEMBER 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 Article

Image may be NSFW.
Clik here to view.

LAG 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 Article

Image may be NSFW.
Clik here to view.

Parent, 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 Article


Image may be NSFW.
Clik here to view.

AllMembers 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 Article

Image may be NSFW.
Clik here to view.

Ancestor

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 Article

Image may be NSFW.
Clik here to view.

Ascendants

The Ascendants functionality gives back all levels from and including the current level.SELECT   Measures.[Sales Amount] ON COLUMNS,   Order(      Ascendants(      [Product].[Product...

View Article


Image may be NSFW.
Clik here to view.

Descendants

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 Article


Image may be NSFW.
Clik here to view.

Cousin

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 Article

Image may be NSFW.
Clik here to view.

Except

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 Article

Image may be NSFW.
Clik here to view.

Intersect

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 Article

Image may be NSFW.
Clik here to view.

UNION

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 Article


Image may be NSFW.
Clik here to view.

RANGE

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 Article

Image may be NSFW.
Clik here to view.

Percentage 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 Article


Image may be NSFW.
Clik here to view.

ParallelPeriod

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 Article

Image may be NSFW.
Clik here to view.

Percentage 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 Article


Image may be NSFW.
Clik here to view.

PeriodsToDate, 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 Article

Image may be NSFW.
Clik here to view.

YearToDate (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 Article

Image may be NSFW.
Clik here to view.

Calculating 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 Article

Image may be NSFW.
Clik here to view.

CASE 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 Article


Image may be NSFW.
Clik here to view.

Calculating 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 Article


Image may be NSFW.
Clik here to view.

ABC 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 Article

multiple first day of week

Nice trick:http://richardlees.blogspot.nl/2015/08/supporting-multiple-first-day-of-week.html

View Article

Past 12 months dynamic

{StrToMember("[Kalender].[J4MND].[Jaar 4MND Maand].&["+Format(DATEADD("M",-1,now()),"yyyyMM")+ "]").Lag(11):StrToMember("[Kalender].[J4MND].[Jaar 4MND...

View Article

Browsing latest articles
Browse All 26 View Live




Latest Images