Market Volume Growth

Created by Vijendra Sawant, Modified on Wed, 22 Nov 2023 at 03:56 PM by Vijendra Sawant


/*
Calculation Script name - WhizCalMarketVolumeGrowth
Description - Market volume growth is the growth in market volume for the current time period vs the previous time period.
              market volume growth of product P1= (market volume of P1 in current period - market volume of P1 in previous period)/(market volume of P1 in previous period)
        
Product Version - v66
Script Version - 1.0

***Disclaimer - This is proprietary code of Whiz.AI. If you want to build on top of this computation script please make a copy/clone of this script and then alter the script which is copied or cloned. When version upgrade happens there are chances that this script may get modified hence any customization done by customer/partner developer may be overwritten.

Key Functions - 1.Function name : getComputationObj
                purpose : get instance of class present in library script.
              
                2.Function name : compute
                purpose : calculate growth in market volume.
                input parameters : metadataQuery, object of WhizCalMarketVolumeLib
                output parameters : dataframe
                                        
Key variables - query : implicit variable
                WhizCalDynamicPeriodLib : The name of the object present in WhizCalDynamicPeriodLib.js(library script).
                                         execution scripts can call WhizCalDynamicPeriodLib scripts functions using given object.
                WhizCalMarketVolumeLib : The name of the object present in WhizCalMarketVolumeLib.js(library script).
                                         execution scripts can call WhizCalMarketVolumeLib scripts functions using given object.
*/
//**Start of Function code

log.info("******************** WhizCalMarketVolumeGrowth **********************");
//name for metadata query, this helps logging and identification of query
query.name("WhizCalMarketVolumeGrowth_Query");

//calling the function from library script 
WhizCalDynamicPeriodLib.getComputationObj().compute(query, WhizCalMarketVolumeLib.getComputationObj());


/*
 ** configuration to be set in Computation metric **

default_filter:In this section, we have added the filter that should be applied by default.
               In Dimension, we mentioned "Market" so that we can add it in dimensions every time by default.
         In this section's dynamicArgs sub-section,
        1.we have added product hierarchy in order to remove the products from filters.
        2."operator": Here we specify which type of operation we want to perform
        3."dim_mix_flag": true - Do not remove product filter
                                  false - Remove product filter
**The configuration below should be copied and pasted to calculate market volume growth. *
*/

"default_filter": {
      "type": "in",
      "column": "Market",
      "values": [
        "AMARD"
      ],
      "dimension": "Market",
      "dynamicArgs": {
        "operator": "percentChange",
        "dim_mix_flag": false,
        "product_hier": [
          "Product Group",
          "Product Name",
          "Product Strength"
        ]
      }
    }

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article