Passing parameters to system modules

I have more than five modules where "reporting date" is a line item and I import values for them. In each of those modules I have another line item to calculate the reporting period based on the reporting dates. Here is the formula for that.

IF DAY(reporting date) <= 15 THEN PERIOD(reporting date) ELSE PERIOD(reporting date) + 1.

Currently i have this formula in each of those 5 modules. Is it possible to centralize this calculation done in a line item of a system module and call it from the 5 modules by passing the reporting date as a parameter. That way if we need to change the formula later, I can modify it one module, rather than 5 modules. I might be able to centralize the threshold days (15) in system module, but I want to know if I can centralize the entire formula.

Any help is appreciated!!

Answers

  • Short answer is yes, and it is the preferred approach to model building where you 'calculate once, reference many times'.

    Benefits include better performance (or rather, less calculations), fewer lines (resulting in lower cell count) and lower maintenance overhead as you can just update the one line instead of making the same change in multiple places.

    As you've noted, having a system module is ideal, particularly for things like time-based calculations or where the logic is common across many modules.

    See the below which explains some common scenarios in more detail,

  • Hi @LalithaPerumal ,
    Yes, that is the preferred approach. Import it to a SYS module & have the period formula there. You can then refer it in the 5 modules as you rightly mentioned.

  • Thank you for the responses. Above examples explain optimization within the same module. It doesn't explain how I pass a variable (Reporting Date - which is a stored value from import) from calling module to the system module without using lookup function. If I use lookup function, then I need to import and store reporting dates from all 5 modules into system module as a line item.

  • Hi @LalithaPerumal,

    It depends on your module dimensions and your model-building choices. Let me show you different builds in a simple Sales Data module. I assume you cannot change the source data and you reporting dates are different for each month but the same for each country.

    Current Build:

    You have Sales Amount, Reporting Date, and Reporting Period line items in the Sales Data module.

    Your cell count is 3x72=216.

    Another Option:

    Change the Reporting Period line item into a subsidiary view.

    Your cell count is 72 + 119+ 12 = 203.

    Note: Subsidiary views are generally not best practice, but you can use them here because they show data in the main module view.

    When it comes to cell sizes, it depends on your time and list dimensions so you will decide if it is worth it. You can consider formula options instead of turning on summaries.

    You can also take the Reporting Period line item into a system module.

    If changing the source data is possible, you can consider making an import action change.

    If your Reporting Date line item is dimensionless and your module doesn't have a time dimension, this structure changes.

    I hope this helps.

    Seyma 🌷🙂

  • devrathahuja
    edited February 7

    Hi @LalithaPerumal ,
    In that case, you can create a system module at day dimension / custom list with all the dates if your model timescale does not support it.

    Write the formula in this system module for the period, it should not be performance heavy as it is a single dimension module with not a complex formula.

    You can then always lookup the period for ANY reporting date across the model by referring to this new line item & also control it centrally.

    You can further optimise the process by switching the line item where you import the dates from date format to this list format instead so that you can skip the finditem step for mapping date to your custom list & directly lookup on that member.

    Hope this helps! :)