View Categories

How to Create OLAP Snippets?

OLAP Snippets are reusable pieces of MDX code that you can create once and use throughout your Jet Reports project. They’re especially helpful when you want to write complex calculations just once and easily apply them in different areas.

 

What is MDX?

 

MDX stands for Multidimensional Expressions, a query language used to pull data from OLAP cubes—commonly used in reporting and analysis tools like Jet Reports.

 

Why Use OLAP Snippets?

  • Reuse the same logic across your project

  • Make maintenance easier

  • Allow other users to work with ready-made logic

  • Use dynamic parameters to adapt to different scenarios

How to Create an OLAP Snippet?

 

Let’s walk through an example:
We’ll create a snippet that returns the value for the previous period based on what’s currently selected.

For example:
If a user selects July 2020, the snippet will return the value for June 2020.
If they select Q1 2020, it will return Q4 2019.

This can be helpful when comparing current and previous periods side-by-side.

Want to turn raw ERP data into powerful business insights?
👉 Join our Jet Analytics Training and master building data warehouses, cubes, and advanced dashboards.

Step-by-Step Instructions

  1. Open Jet Data Manager
    Go to the Tools tab and click Snippets. create olap snippets

  2. Add a New Snippet
    Click Add → Select SSAS Multidimensional Snippet. create olap snippets

  3. Fill Out the Snippet Info

    • Give your snippet a name. (e.g., Prior Period)

    • Optionally, write a short description.

    • Enter your MDX code:

       
      ([Date Hierarchy].CurrentMember.PrevMember, [Measure])
      mceclip2.png
  4. Add Parameters
    Now we’ll make parts of the formula dynamic, so other users can customize them:

    • Highlight [Date Hierarchy] and click Add Parameter
      → Set Type to Hierarchy
      → Add a description (optional)

    • Highlight [Measure] and click Add Parameter
      → Set Type to Measure
      → Add a description (optional) parameters in olap snippets

  5. Organize the Snippet (Optional)
    If you’re using folders for snippets, choose where this one should go.
    For this example, you might place it under the Time folder. create olap snippets

  6. Save the Snippet
    Click OK to save it in your project.

 

And that’s it! You now have a dynamic, reusable OLAP Snippet that calculates the prior period’s value—ready to be used in your Jet Reports project.

 

If You Need Any Help, Contact us Now!