LEAD Function in MDX

19
4867
LEAD Function
LEAD Function

Friends,

If you have read the article about LAG then you will easily say that LEAD is just opposite to LAG function after finished reading this article.LEAD is a Navigation Function which returns a value(member) that is N number of positions following the supplied member in the given attribute. Typical uses of this function is to navigate back or forward to N positions from the given member. PFB the syntax of LEAD function –

Member_Expression.Lead(Index)
Member_Expression - A valid Attribute Member .
Index - The number of positions we wish to navigate.

Member positions within a level are determined by the attribute hierarchy’s natural order. The numbering of the positions is zero-based. If the specified lead is zero (0), the Lead function returns the specified member. If you specified 1(One) then it will take you forward by one Member, if 2(Two) then will navigate forward by two members from the current member.

Positive Lead and Negative Lead –

If you specify a POSITIVE number as Index then it will go forward from the current member and this is called POSITIVE LEAD. Lets see an example for Positive Lead here.

Select [Date].[Fiscal].[Month].[January 2001].Lead(5) on 0

from [Adventure Works].

If you see the above query member expression is “[Date].[Fiscal].[Month].[January 2001]” and current member is “January 2001”. We have given LEAD(5) and hence it will navigate forward by FIVE members and will return “June 2001” as output if that member exists in Cube.

If you specify a NEGATIVE number as Index then it will go back from the current member and this is called NEGATIVE LEAD. Lets see an example for Negative Lead here.

Select [Date].[Fiscal].[Month].[January 2001].LEAD(-5) on 0

from [Adventure Works].

If you see the above query member expression is “[Date].[Fiscal].[Month].[January 2001]” and current member is “January 2001”. We have given LEAD(-5) and hence it will navigate back by FIVE members and will return “August 2000” as output if that member exists in Cube.

PFB screenshot which shows an example for Lead function.
LEAD Function
LEAD Function

Note – Lead looks like a simple function and not much useful one in real time scenarios but this function in combination with other functions like CLOSING PERIOD or RANGE functions will be most powerful and useful one.

Remember – Positive Lead = Negative Lag and Negative Lead = Positive Lag.

That’s it  .. Happy Coding !!

Regards,

Roopesh Babu V


19 COMMENTS

  1. For the patients, the factors most significantly associated with treatment preference were differences in time concerns, choice of dose, intercourse satisfaction, number of sexual attempts, satisfaction with erection hardness and the absence of or only minor side effects priligy canada

  2. Therefore, when VIAGRA is co-administered with alpha-blockers, patients should be stable on alpha-blocker therapy prior to initiating VIAGRA treatment and VIAGRA should be initiated at the lowest dose see WARNINGS AND PRECAUTIONS best generic cialis

  3. If the abscess formed inside a tooth then a hole is drilled into the hole to allow draining of the abscess cialis for sale online With with help of our online pharmacy it is possible to order generics of Viagra and Cialis at a bargain price in New Orleans, Louisiana of the USA

  4. One of the drug s most successful competitors, Cialis, was released in 2003, and this expensive but effective medication quickly became a heavy hitter in the list of treatment options for erectile dysfunction buy cialis online usa Add indication message here

  5. The Freda subscription box is the very first in the UK to deliver organic and natural period care to your door. Each month, you will receive 16 products of your choice including; pantyliners, night pads, day pads and tampons while fighting against period poverty around the world. There are even teen variations and a starter box. Every month, you’ll receive 4 products with a $60-$100 value. Enjoy a mix of makeup, hair care, body & skincare curated to match your beauty profile. Treat yourself and your skin by getting the best beauty box subscription out there! Use this popup to embed a mailing list sign up form. Offer incentives to customers to join and build your mailing list. Boxycharm is a monthly subscription box that sends 4-5 full-size makeup and beauty products to your door for the price of one. For just $27.99 per month, subscribers receive a box filled with products with an average value of $175. The Boxycharm subscription box includes products from both high-end and drugstore brands, making it easy to discover new favorites. Past boxes included products from major brands like Oribe, Haus Labs, and NARS. Plus, they often include unique products that you can’t find anywhere else. https://seekingmaryhudson.com/community/profile/andre9278619534 Next: Here’s How Makeup Artists Achieve Flawless Eye Shadow Looks Every Damn Time Pay: $15.00 per hour Darlings, unlock the secret to a runway-ready BRONZE, SCULPT and GLOW with my NEW! Glowgasm face palette in Nudegasm! Inspired by my globally-loved Glowgasm palettes and backstage beauty secrets, this nude makeup palette of universally-flattering, blurring, smoothing and illuminating effect shades brings instant SUPER STAR MAGIC to any makeup look for EVERYONE, EVERYWHERE! Standard delivery in 6-12 business days from despatchFinal mile delivery will be with your local postal service Your bag is empty. %2Fon%2Fdemandware.static%2F-%2FSites-masterCatalog_Pupa%2Fdefault%2Fdwc8803424%2FImmagini%2Flarge%2F040276A001_8011607302659_MakeupStoriesSpicyNudes_big_28052018142321.png Makeup by Mario The Nudes 1 is a limited edition eye palette that retails for $25.00 and contains 0.2 oz.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

91 − = 90