Market Volume

Created by Vijendra Sawant, Modified on Thu, 2 Nov, 2023 at 12:04 AM by Vijendra Sawant


/*
Calculation Script name - WhizCalMarketVolume
Description - Market Volume computation is used to calculate the entire volume of a specified market in the filter,
       For this metric, Market should always be in the filter. 
       
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 WhizCalMarketVolumeLib.
                2.Function name : compute
                purpose : calculate market volume.
                input parameters :metadataQuery
                output parameters : dataframe
              
Key variables - query : implicit variable
                WhizCalMarketVolumeLib : The name of the object present in WhizCalMarketVolumeLib.js(library script).
                                         excution scripts can call WhizCalMarketVolumeLib scripts functions using given object.
*/



//**  Start of Function code  **//

log.info("******************** WhizCalMarketVolume **********************");

//Name for metadata query, this helps logging and identification of query.
query.name("WhizCalMarketVolume_Query");

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

//**  End of Function code  **//


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

default_filter: 1.In this section, we have added the filter that should be applied by default
        2.In Dimension, we mentioned "Market" so that we can add it in dimensions every time by default.
        3.In this section's dynamicArgs sub-section,
        we have added product hierarchy in order to remove the products from filters.

**The configuration below should be copied and pasted to calculate the Market Volume.*
*/

"default_filter": {
    "type": "in",
    "column": "Market",
    "values": [
      "AMARD"
    ],
    "dimension": "Market",
    "dynamicArgs": {
      "dim_mix_flag": false,
      "product_hier": [
        "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 at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article