LEAD Function in MDX

11
28817
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


11 COMMENTS

  1. His symptoms have been present for approximately 48 hours and his history reveals unprotected receptive anal intercourse with another man 12 days prior to the onset of his symptoms.
    Report errors in your meds immediately when you how to get sildenafil at fantastic prices so that you can reduce symptoms and get
    Overall, studies have shown that fibromyalgia can be as disabling and life-impacting as rheumatoid arthritis.

  2. Arrowheads reveal the presence of a mysterious army in Europe’s oldest battle
    порно жесток
    Today, the lush, green valley surrounding the Tollense River in northeast Germany appears to be a serene place to appreciate nature.

    But to archaeologists, the Tollense Valley is considered Europe’s oldest battlefield.

    An amateur archaeologist first spotted a bone sticking out of the riverbank in 1996.

    A series of ongoing site excavations since 2008 has shown that the thousands of bones and hundreds of weapons preserved by the valley’s undisturbed environment were part of a large-scale battle 3,250 years ago.

    The biggest mysteries that researchers aim to uncover are why the battle occurred and who fought in it. These are questions that they are now one step closer to answering.
    ozens of bronze and flint arrowheads recovered from the Tollense Valley are revealing details about the able-bodied warriors who fought in the Bronze Age battle.

    The research team analyzed and compared the arrowheads, some of which were still embedded in the remains of the fallen. While many of these weapons were locally produced, some bearing different shapes came from a region that now includes modern Bavaria and Moravia.

    The outliers’ presence suggests that a southern army clashed with local tribes in the valley, and researchers suspect the conflict began at a key landmark along the river.

    Back to the future
    Scientists are harnessing the power of artificial intelligence to detect hidden archaeological sites buried below the sand of the sprawling Rub‘ al-Khali desert.

    The desert spans 250,000 square miles (650,000 square kilometers) on the Arabian Peninsula, and its name translates to “the Empty Quarter” in English. To unravel the secrets of the desolate terrain, researchers are combining machine learning with a satellite imagery technique that uses radio waves to spot objects that may be concealed beneath surfaces.

    The technology will be tested in October when excavations assess whether predicted structures are present at the Saruq Al Hadid complex in Dubai, United Arab Emirates.

    Separately, an AI-assisted analysis uncovered a trove of ancient symbols in Peru’s Nazca Desert, nearly doubling the number of known geoglyphs, or stone and gravel arranged into giant shapes that depict animals, humans and geometric designs.

  3. When applied to a woman’s genital area, particles of talc can actually migrate through the woman’s reproductive system to the ovaries, where they can remain for as much as eight years, often resulting in inflammation and subsequent cancer cell growth.
    Watch out for substandard product with buying vardenafil tablet , an effective treatment, at greatly reduced prices
    This method performs well as long as the number of features relative to the number of samples is low.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

thirty eight − thirty three =