Automated Card Backup

Backup
Cards
Author

Jae Wilson

Published

April 14, 2023

a short post on using DomoLibrary to automate dataset tagging

Project Configuration

import domolibrary.client.DomoAuth as dmda
import os

token_auth = dmda.DomoTokenAuth(
    domo_instance=os.environ['DOMO_INSTANCE'],
    domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
)

await token_auth.get_auth_token()

assert isinstance(token_auth.token, str)

Get Cards

import domolibrary.classes.DomoDatacenter as ddc

domo_datasets = await ddc.DomoDatacenter.search_datasets(
    auth=token_auth,
)

domo_datasets[0:5]
[DomoDataset(id='da552832-c04d-46ac-936a-f982d9d3f2e6', display_type='api', data_provider_type=None, name='SalesProject01_hello world_INT *', description=None, row_count=0, column_count=0, stream_id=None, owner={'id': '1893952720', 'name': 'Jae Wilson1', 'type': 'USER', 'group': False}, formula={}, Schema=DomoDataset_Schema(dataset_id='da552832-c04d-46ac-936a-f982d9d3f2e6', columns=[]), Stream=DomoStream(id=None, dataset_id='da552832-c04d-46ac-936a-f982d9d3f2e6', transport_description=None, transport_version=None, update_method=None, data_provider_name=None, data_provider_key=None, account_id=None, account_display_name=None, account_userid=None, has_mapping=False, configuration=[], configuration_tables=[], configuration_query=None), Tags=DomoTags(tag_ls=['provider_type : api *', 'proj_phase : 01 *', 'proj_name : SalesProject *', 'ds_type : INT *']), PDP=<domolibrary.classes.DomoPDP.Dataset_PDP_Policies object>, Certification=None),
 DomoDataset(id='581b58d6-4554-46c6-b0e0-c7c2f782df90', display_type='DataFlow', data_provider_type=None, name='[Alerts Demo June 22] Pipeline Validation', description=None, row_count=270, column_count=10, stream_id=1893, owner={'id': '307632801', 'name': 'Dan Brinton', 'type': 'USER', 'group': False}, formula={'calculation_036d74aa-f958-4b85-82e9-a3f1a10c4ab5': {'templateId': 1293, 'id': 'calculation_036d74aa-f958-4b85-82e9-a3f1a10c4ab5', 'name': 'Open Validation Issues', 'formula': 'sum(case when `Amount Diff` <> 0 then 1 else 0 end)', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Amount Diff`', 'columnPosition': 14}], 'variable': False}}, Schema=DomoDataset_Schema(dataset_id='581b58d6-4554-46c6-b0e0-c7c2f782df90', columns=[]), Stream=DomoStream(id=1893, dataset_id='581b58d6-4554-46c6-b0e0-c7c2f782df90', transport_description=None, transport_version=None, update_method=None, data_provider_name=None, data_provider_key=None, account_id=None, account_display_name=None, account_userid=None, has_mapping=False, configuration=[], configuration_tables=[], configuration_query=None), Tags=DomoTags(tag_ls=['developer_documentation', 'hackercore']), PDP=<domolibrary.classes.DomoPDP.Dataset_PDP_Policies object>, Certification=None),
 DomoDataset(id='61c4e63d-0627-41f7-b138-74968ebd7634', display_type='domostats', data_provider_type='domostats', name='DomoStats - Activity Log', description='Domo Stats', row_count=3383565, column_count=17, stream_id=307, owner={'id': '587894148', 'name': 'Bryan Van Kampen', 'type': 'USER', 'group': False}, formula={'calculation_5deab6ee-8663-4d59-a670-6d581f1be22f': {'templateId': 1079, 'id': 'calculation_5deab6ee-8663-4d59-a670-6d581f1be22f', 'name': 'Logins (Merged from datasource: 61c4e63d-0627-41f7-b138-74968ebd7634)', 'formula': "(CASE WHEN `Action` IN ('LOGGEDIN', 'LOGGEDIN_SSO', 'LOGGEDIN_TWO_FACTOR') THEN 'Y' ELSE 'N' END)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Action`', 'columnPosition': 11}], 'variable': False}, 'calculation_b80f5ea7-297d-4f38-9e47-b606356994f8': {'templateId': 357, 'id': 'calculation_b80f5ea7-297d-4f38-9e47-b606356994f8', 'name': 'Distinct User', 'formula': 'COUNT(DISTINCT `Name`)', 'status': 'VALID', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Name`', 'columnPosition': 15}], 'variable': False}, 'calculation_a3478054-b428-4a47-86e1-ef41f550bd0b': {'templateId': 361, 'id': 'calculation_a3478054-b428-4a47-86e1-ef41f550bd0b', 'name': 'Failed Login', 'formula': "(CASE  WHEN (`Action` = 'FAILED_LOGIN') THEN `Action` END )", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Action`', 'columnPosition': 13}, {'columnName': '`Action`', 'columnPosition': 45}], 'variable': False}, 'calculation_eb7aa11e-f032-4723-9a98-6b50d475bcd8': {'templateId': 359, 'id': 'calculation_eb7aa11e-f032-4723-9a98-6b50d475bcd8', 'name': 'Behavior String', 'formula': "CONCAT('At ',`Event_Time`,' ',`Name`,' ',`Action`,' ','the ',`Object_Type`,' ',`Object_Name`)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Event_Time`', 'columnPosition': 13}, {'columnName': '`Name`', 'columnPosition': 30}, {'columnName': '`Action`', 'columnPosition': 41}, {'columnName': '`Object_Type`', 'columnPosition': 61}, {'columnName': '`Object_Name`', 'columnPosition': 79}], 'variable': False}, 'calculation_20ce4ae4-badc-4180-9e07-5f109e5d9d82': {'templateId': 360, 'id': 'calculation_20ce4ae4-badc-4180-9e07-5f109e5d9d82', 'name': 'Logins', 'formula': "(CASE  WHEN `Action` IN ('LOGGEDIN','LOGGEDIN_SSO','LOGGEDIN_TWO_FACTOR') THEN 'Y' ELSE 'N' END )", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Action`', 'columnPosition': 12}], 'variable': False}, 'calculation_0198fd23-4e28-4d22-b442-f1f68c0486b6': {'templateId': 1078, 'id': 'calculation_0198fd23-4e28-4d22-b442-f1f68c0486b6', 'name': 'Formatted Behavior String (Merged from datasource: 61c4e63d-0627-41f7-b138-74968ebd7634)', 'formula': 'CONCAT(\'<b>\', `Name`, \' at \', `Event_Time`, \': </b>\', LOWER(`Action`), \' \', \'the \', LOWER(`Object_Type`), \' "\', LOWER(`Object_Name`), \'"\')', 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Name`', 'columnPosition': 14}, {'columnName': '`Event_Time`', 'columnPosition': 30}, {'columnName': '`Action`', 'columnPosition': 60}, {'columnName': '`Object_Type`', 'columnPosition': 90}, {'columnName': '`Object_Name`', 'columnPosition': 118}], 'variable': False}, 'calculation_624dc0e1-ac48-4a78-80e8-e10461b5d01d': {'templateId': 358, 'id': 'calculation_624dc0e1-ac48-4a78-80e8-e10461b5d01d', 'name': 'Formatted Behavior String', 'formula': 'CONCAT(\'<b>\',`Name`,\' at \',`Event_Time`,\': </b>\',LOWER(`Action`),\' \',\'the \',LOWER(`Object_Type`),\' "\',LOWER(`Object_Name`),\'"\')', 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Name`', 'columnPosition': 13}, {'columnName': '`Event_Time`', 'columnPosition': 27}, {'columnName': '`Action`', 'columnPosition': 55}, {'columnName': '`Object_Type`', 'columnPosition': 82}, {'columnName': '`Object_Name`', 'columnPosition': 108}], 'variable': False}, 'calculation_418a84db-006f-4bfc-b72a-243b0263d4df': {'templateId': 1080, 'id': 'calculation_418a84db-006f-4bfc-b72a-243b0263d4df', 'name': 'Failed Login (Merged from datasource: 61c4e63d-0627-41f7-b138-74968ebd7634)', 'formula': "(CASE WHEN (`Action` = 'FAILED_LOGIN') THEN `Action` END)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Action`', 'columnPosition': 12}, {'columnName': '`Action`', 'columnPosition': 44}], 'variable': False}, 'calculation_8626da93-6edb-4263-a68a-793c916faf0f': {'templateId': 1077, 'id': 'calculation_8626da93-6edb-4263-a68a-793c916faf0f', 'name': 'Behavior String (Merged from datasource: 61c4e63d-0627-41f7-b138-74968ebd7634)', 'formula': "CONCAT('At ', `Event_Time`, ' ', `Name`, ' ', `Action`, ' ', 'the ', `Object_Type`, ' ', `Object_Name`)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Event_Time`', 'columnPosition': 14}, {'columnName': '`Name`', 'columnPosition': 33}, {'columnName': '`Action`', 'columnPosition': 46}, {'columnName': '`Object_Type`', 'columnPosition': 69}, {'columnName': '`Object_Name`', 'columnPosition': 89}], 'variable': False}, 'calculation_098eea28-d300-4221-892c-4a1317ef639a': {'templateId': 363, 'id': 'calculation_098eea28-d300-4221-892c-4a1317ef639a', 'name': 'Time Since Last Update Sort', 'formula': '(CASE  WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 0) THEN 1 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 1) THEN 2 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 2) THEN 3 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 3) THEN 4 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 4) THEN 5 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 5) THEN 6 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 6) THEN 7 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 7) THEN 8 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 8) THEN 9 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 9) THEN 10 WHEN (DATEDIFF(CURDATE(),`Event_Time`) = 10) THEN 11 ELSE 12 END )', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Event_Time`', 'columnPosition': 32}, {'columnName': '`Event_Time`', 'columnPosition': 83}, {'columnName': '`Event_Time`', 'columnPosition': 134}, {'columnName': '`Event_Time`', 'columnPosition': 185}, {'columnName': '`Event_Time`', 'columnPosition': 236}, {'columnName': '`Event_Time`', 'columnPosition': 287}, {'columnName': '`Event_Time`', 'columnPosition': 338}, {'columnName': '`Event_Time`', 'columnPosition': 389}, {'columnName': '`Event_Time`', 'columnPosition': 440}, {'columnName': '`Event_Time`', 'columnPosition': 491}, {'columnName': '`Event_Time`', 'columnPosition': 543}], 'variable': False}, 'calculation_947f77ff-7d78-462e-a5ca-2199b919d3c3': {'templateId': 1129, 'id': 'calculation_947f77ff-7d78-462e-a5ca-2199b919d3c3', 'name': 'RowCount', 'formula': 'sum(1)', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'variable': False}, 'calculation_246dbded-588e-41ab-8b00-cae08755a2a9': {'templateId': 1081, 'id': 'calculation_246dbded-588e-41ab-8b00-cae08755a2a9', 'name': 'Login Failure Rate (Merged from datasource: 61c4e63d-0627-41f7-b138-74968ebd7634)', 'formula': "(COUNT((CASE WHEN (`Action` = 'FAILED_LOGIN') THEN `Action` END)) / COUNT((CASE WHEN `Action` IN ('LOGGEDIN', 'FAILED_LOGIN') THEN `Action` END)))", 'status': 'VALID', 'dataType': 'DECIMAL', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Action`', 'columnPosition': 19}, {'columnName': '`Action`', 'columnPosition': 51}, {'columnName': '`Action`', 'columnPosition': 85}, {'columnName': '`Action`', 'columnPosition': 131}], 'variable': False}, 'calculation_bb8339c9-63bb-4cf2-81d5-0fbe9ffadfd1': {'templateId': 1082, 'id': 'calculation_bb8339c9-63bb-4cf2-81d5-0fbe9ffadfd1', 'name': 'Time Since Last Update Sort (Merged from datasource: 61c4e63d-0627-41f7-b138-74968ebd7634)', 'formula': '(CASE WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 0) THEN 1 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 1) THEN 2 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 2) THEN 3 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 3) THEN 4 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 4) THEN 5 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 5) THEN 6 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 6) THEN 7 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 7) THEN 8 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 8) THEN 9 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 9) THEN 10 WHEN (DATEDIFF(CURDATE(), `Event_Time`) = 10) THEN 11 ELSE 12 END)', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Event_Time`', 'columnPosition': 32}, {'columnName': '`Event_Time`', 'columnPosition': 84}, {'columnName': '`Event_Time`', 'columnPosition': 136}, {'columnName': '`Event_Time`', 'columnPosition': 188}, {'columnName': '`Event_Time`', 'columnPosition': 240}, {'columnName': '`Event_Time`', 'columnPosition': 292}, {'columnName': '`Event_Time`', 'columnPosition': 344}, {'columnName': '`Event_Time`', 'columnPosition': 396}, {'columnName': '`Event_Time`', 'columnPosition': 448}, {'columnName': '`Event_Time`', 'columnPosition': 500}, {'columnName': '`Event_Time`', 'columnPosition': 553}], 'variable': False}, 'calculation_b9a7911e-4b1b-40ce-a841-1587e45bf987': {'templateId': 362, 'id': 'calculation_b9a7911e-4b1b-40ce-a841-1587e45bf987', 'name': 'Login Failure Rate', 'formula': "(COUNT((CASE  WHEN (`Action` = 'FAILED_LOGIN') THEN `Action` END )) / COUNT((CASE  WHEN `Action` IN ('LOGGEDIN','FAILED_LOGIN') THEN `Action` END )))", 'status': 'VALID', 'dataType': 'DECIMAL', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Action`', 'columnPosition': 20}, {'columnName': '`Action`', 'columnPosition': 52}, {'columnName': '`Action`', 'columnPosition': 88}, {'columnName': '`Action`', 'columnPosition': 133}], 'variable': False}}, Schema=DomoDataset_Schema(dataset_id='61c4e63d-0627-41f7-b138-74968ebd7634', columns=[]), Stream=DomoStream(id=307, dataset_id='61c4e63d-0627-41f7-b138-74968ebd7634', transport_description=None, transport_version=None, update_method=None, data_provider_name=None, data_provider_key=None, account_id=None, account_display_name=None, account_userid=None, has_mapping=False, configuration=[], configuration_tables=[], configuration_query=None), Tags=DomoTags(tag_ls=['s_domostats', 'um_REPLACE', 'udt_DAY at 4:55 PM', 'domostats']), PDP=<domolibrary.classes.DomoPDP.Dataset_PDP_Policies object>, Certification=None),
 DomoDataset(id='ea859b06-5dbe-4c31-be76-de921447d550', display_type='dataset-view', data_provider_type='dataset-view', name='Transaction product sales', description='', row_count=0, column_count=32, stream_id=699, owner={'id': '316139172', 'name': 'Matt Tannyhill', 'type': 'USER', 'group': False}, formula={'calculation_e01a10c1-2f65-48ad-b0bb-1a7ff69bfc52': {'templateId': 1372, 'id': 'calculation_e01a10c1-2f65-48ad-b0bb-1a7ff69bfc52', 'name': 'Current Time Range', 'formula': "(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN \n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n  \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n              WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 174}, {'columnName': '`Updated Order Date`', 'columnPosition': 210}, {'columnName': '`Total Sales`', 'columnPosition': 261}, {'columnName': '`Updated Order Date`', 'columnPosition': 429}, {'columnName': '`Updated Order Date`', 'columnPosition': 478}, {'columnName': '`Updated Order Date`', 'columnPosition': 514}, {'columnName': '`Total Sales`', 'columnPosition': 565}, {'columnName': '`Updated Order Date`', 'columnPosition': 731}, {'columnName': '`Updated Order Date`', 'columnPosition': 782}, {'columnName': '`Updated Order Date`', 'columnPosition': 819}, {'columnName': '`Total Sales`', 'columnPosition': 870}, {'columnName': '`Updated Order Date`', 'columnPosition': 1033}, {'columnName': '`Updated Order Date`', 'columnPosition': 1082}, {'columnName': '`Updated Order Date`', 'columnPosition': 1118}, {'columnName': '`Total Sales`', 'columnPosition': 1169}, {'columnName': '`Updated Order Date`', 'columnPosition': 1397}, {'columnName': '`Updated Order Date`', 'columnPosition': 1433}, {'columnName': '`Total Sales`', 'columnPosition': 1483}, {'columnName': '`Updated Order Date`', 'columnPosition': 1651}, {'columnName': '`Updated Order Date`', 'columnPosition': 1700}, {'columnName': '`Updated Order Date`', 'columnPosition': 1736}, {'columnName': '`Total Sales`', 'columnPosition': 1786}, {'columnName': '`Updated Order Date`', 'columnPosition': 1950}, {'columnName': '`Updated Order Date`', 'columnPosition': 1999}, {'columnName': '`Updated Order Date`', 'columnPosition': 2035}, {'columnName': '`Total Sales`', 'columnPosition': 2085}, {'columnName': '`Updated Order Date`', 'columnPosition': 2247}, {'columnName': '`Updated Order Date`', 'columnPosition': 2296}, {'columnName': '`Updated Order Date`', 'columnPosition': 2332}, {'columnName': '`Total Sales`', 'columnPosition': 2382}], 'variable': False}, 'calculation_d9a6f946-2ff2-45ee-8344-20eaa6d9f814': {'templateId': 1432, 'id': 'calculation_d9a6f946-2ff2-45ee-8344-20eaa6d9f814', 'name': '% Diff (Level 1)', 'formula': "SUM(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n     (CASE\n        WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n        ELSE 0\n      END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n     (CASE\n        WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n        ELSE 0\n      END)\nEND)\n/\n(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n       (CASE \n          WHEN WEEK(CURDATE()) = 1 THEN\n            (CASE\n               WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n               ELSE 0\n             END)\n          WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n          ELSE 0\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n       (CASE \n          WHEN WEEK(CURDATE()) = 1 THEN\n            (CASE\n               WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n               ELSE 0\n             END)\n          WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n          ELSE 0\n        END)\nEND)\n-1", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 103}, {'columnName': '`Updated Order Date`', 'columnPosition': 152}, {'columnName': '`Updated Order Date`', 'columnPosition': 188}, {'columnName': '`Total Sales`', 'columnPosition': 239}, {'columnName': '`Updated Order Date`', 'columnPosition': 368}, {'columnName': '`Updated Order Date`', 'columnPosition': 417}, {'columnName': '`Updated Order Date`', 'columnPosition': 453}, {'columnName': '`Total Sales`', 'columnPosition': 503}, {'columnName': '`Updated Order Date`', 'columnPosition': 700}, {'columnName': '`Updated Order Date`', 'columnPosition': 756}, {'columnName': '`Updated Order Date`', 'columnPosition': 792}, {'columnName': '`Total Sales`', 'columnPosition': 843}, {'columnName': '`Updated Order Date`', 'columnPosition': 935}, {'columnName': '`Updated Order Date`', 'columnPosition': 986}, {'columnName': '`Updated Order Date`', 'columnPosition': 1022}, {'columnName': '`Total Sales`', 'columnPosition': 1073}, {'columnName': '`Updated Order Date`', 'columnPosition': 1256}, {'columnName': '`Updated Order Date`', 'columnPosition': 1312}, {'columnName': '`Updated Order Date`', 'columnPosition': 1348}, {'columnName': '`Total Sales`', 'columnPosition': 1398}, {'columnName': '`Updated Order Date`', 'columnPosition': 1490}, {'columnName': '`Updated Order Date`', 'columnPosition': 1541}, {'columnName': '`Updated Order Date`', 'columnPosition': 1577}, {'columnName': '`Total Sales`', 'columnPosition': 1627}], 'variable': False}, 'calculation_f865240a-4b55-473b-8606-a06a8a8db68f': {'templateId': 1424, 'id': 'calculation_f865240a-4b55-473b-8606-a06a8a8db68f', 'name': 'Table metric 1 BM', 'formula': "CASE \n\nWHEN DOMO_BEAST_MODE(1418) = 'Sales $' THEN SUM(`Total Sales`)\nWHEN DOMO_BEAST_MODE(1418) = 'Units' then SUM(`Order Quantity`)\nWHEN DOMO_BEAST_MODE(1418) = 'Orders' then SUM(`Order Quantity`)/5\n\nEND", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Total Sales`', 'columnPosition': 55}, {'columnName': '`Order Quantity`', 'columnPosition': 116}, {'columnName': '`Order Quantity`', 'columnPosition': 181}], 'variable': False}, 'calculation_7d97eed1-cd93-40e2-b6fb-d08ddc595fce': {'templateId': 1375, 'id': 'calculation_7d97eed1-cd93-40e2-b6fb-d08ddc595fce', 'name': 'BM Metric', 'formula': "CASE \nWHEN DOMO_BEAST_MODE(1361) = 'Sales' then SUM(`Total Sales`)\nWHEN DOMO_BEAST_MODE(1361) = 'Units' then SUM(`Store Sls`)/20\nWHEN DOMO_BEAST_MODE(1361) = 'Orders' then SUM(`Order Quantity`)\nEND", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Total Sales`', 'columnPosition': 52}, {'columnName': '`Store Sls`', 'columnPosition': 113}, {'columnName': '`Order Quantity`', 'columnPosition': 176}], 'variable': False}, 'calculation_0c8ecaee-27f1-433f-970c-0d78b7b26a0e': {'templateId': 1429, 'id': 'calculation_0c8ecaee-27f1-433f-970c-0d78b7b26a0e', 'name': 'Comparison Time Range (Level 1)', 'formula': "(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n       (CASE \n          WHEN WEEK(CURDATE()) = 1 THEN\n            (CASE\n               WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n               ELSE 0\n             END)\n          WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n          ELSE 0\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n       (CASE \n          WHEN WEEK(CURDATE()) = 1 THEN\n            (CASE\n               WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n               ELSE 0\n             END)\n          WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n          ELSE 0\n        END)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 150}, {'columnName': '`Updated Order Date`', 'columnPosition': 206}, {'columnName': '`Updated Order Date`', 'columnPosition': 242}, {'columnName': '`Total Sales`', 'columnPosition': 293}, {'columnName': '`Updated Order Date`', 'columnPosition': 385}, {'columnName': '`Updated Order Date`', 'columnPosition': 436}, {'columnName': '`Updated Order Date`', 'columnPosition': 472}, {'columnName': '`Total Sales`', 'columnPosition': 523}, {'columnName': '`Updated Order Date`', 'columnPosition': 706}, {'columnName': '`Updated Order Date`', 'columnPosition': 762}, {'columnName': '`Updated Order Date`', 'columnPosition': 798}, {'columnName': '`Total Sales`', 'columnPosition': 848}, {'columnName': '`Updated Order Date`', 'columnPosition': 940}, {'columnName': '`Updated Order Date`', 'columnPosition': 991}, {'columnName': '`Updated Order Date`', 'columnPosition': 1027}, {'columnName': '`Total Sales`', 'columnPosition': 1077}], 'variable': False}, 'calculation_a696d975-95a6-42c7-b140-f184221d748d': {'templateId': 1443, 'id': 'calculation_a696d975-95a6-42c7-b140-f184221d748d', 'name': 'Week', 'formula': 'WEEK(`Updated Order Date`)', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 5}], 'variable': False}, 'calculation_ce47bb82-5c29-4057-8b34-ca32791e595c': {'templateId': 2653, 'id': 'calculation_ce47bb82-5c29-4057-8b34-ca32791e595c', 'name': 'BM Dimension 2', 'formula': "(CASE \nWHEN DOMO_BEAST_MODE(1358) = 'Region' then `Region`\nWHEN DOMO_BEAST_MODE(1358) = 'State' then `State`\nWHEN DOMO_BEAST_MODE(1358) = 'City' THEN `City`\nWHEN DOMO_BEAST_MODE(1358) = 'Brand' THEN `Brand`\nWHEN DOMO_BEAST_MODE(1358) = 'Category' THEN `Product Category`\nWHEN DOMO_BEAST_MODE(1358) = 'Dept' THEN `Department`\nEND)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 50}, {'columnName': '`State`', 'columnPosition': 101}, {'columnName': '`City`', 'columnPosition': 150}, {'columnName': '`Brand`', 'columnPosition': 199}, {'columnName': '`Product Category`', 'columnPosition': 252}, {'columnName': '`Department`', 'columnPosition': 312}], 'variable': False}, 'calculation_32aea1ec-1aad-46ad-84ca-bad989ffff62': {'templateId': 3790, 'id': 'calculation_32aea1ec-1aad-46ad-84ca-bad989ffff62', 'name': 'Dimension ', 'formula': "CASE WHEN `Dimension switch` = 'Brand' Then `Brand`WHEN `Dimension switch` = 'Region' Then `Region`WHEN `Dimension switch` = 'Category' Then `Product Category`WHEN `Dimension switch` = 'Sub category' Then `Product Sub-Category`WHEN `Dimension switch` = 'State' Then `State`WHEN `Dimension switch` = 'City' Then `City`WHEN `Dimension switch` = 'Dept' Then `Department`END", 'status': 'VALID', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Dimension switch`', 'columnPosition': 10}, {'columnName': '`Brand`', 'columnPosition': 44}, {'columnName': '`Dimension switch`', 'columnPosition': 56}, {'columnName': '`Region`', 'columnPosition': 91}, {'columnName': '`Dimension switch`', 'columnPosition': 104}, {'columnName': '`Product Category`', 'columnPosition': 141}, {'columnName': '`Dimension switch`', 'columnPosition': 164}, {'columnName': '`Product Sub-Category`', 'columnPosition': 205}, {'columnName': '`Dimension switch`', 'columnPosition': 232}, {'columnName': '`State`', 'columnPosition': 266}, {'columnName': '`Dimension switch`', 'columnPosition': 278}, {'columnName': '`City`', 'columnPosition': 311}, {'columnName': '`Dimension switch`', 'columnPosition': 322}, {'columnName': '`Department`', 'columnPosition': 355}], 'variable': False}, 'calculation_649c4c0a-ab31-481a-8b95-1e08dc94ab78': {'templateId': 1440, 'id': 'calculation_649c4c0a-ab31-481a-8b95-1e08dc94ab78', 'name': 'Day of Quarter', 'formula': "-- DayOfQuarter\n  (case\n    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n  end)", 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 39}, {'columnName': '`Updated Order Date`', 'columnPosition': 80}, {'columnName': '`Updated Order Date`', 'columnPosition': 114}, {'columnName': '`Updated Order Date`', 'columnPosition': 166}, {'columnName': '`Updated Order Date`', 'columnPosition': 207}, {'columnName': '`Updated Order Date`', 'columnPosition': 241}, {'columnName': '`Updated Order Date`', 'columnPosition': 293}, {'columnName': '`Updated Order Date`', 'columnPosition': 334}, {'columnName': '`Updated Order Date`', 'columnPosition': 368}, {'columnName': '`Updated Order Date`', 'columnPosition': 423}, {'columnName': '`Updated Order Date`', 'columnPosition': 457}], 'variable': False}, 'calculation_6ccfeaec-d7d9-4fa4-854f-fa7c5221e001': {'templateId': 1391, 'id': 'calculation_6ccfeaec-d7d9-4fa4-854f-fa7c5221e001', 'name': 'BM Date range 2', 'formula': 'CASE \n\tWHEN `Updated Order Date` >= DOMO_BEAST_MODE(1390) AND `Updated Order Date` <= DOMO_BEAST_MODE(1389) THEN `Total Sales`\n    ELSE 0\nEND', 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 12}, {'columnName': '`Updated Order Date`', 'columnPosition': 62}, {'columnName': '`Total Sales`', 'columnPosition': 113}], 'variable': False}, 'calculation_282a934a-f1f9-4ad2-8efd-ae2e985b9f4e': {'templateId': 1423, 'id': 'calculation_282a934a-f1f9-4ad2-8efd-ae2e985b9f4e', 'name': 'Table Column group 1', 'formula': "CASE \nWHEN DOMO_BEAST_MODE(1417) = 'Region' then `Region`\nWHEN DOMO_BEAST_MODE(1417) = 'State' then `State`\nWHEN DOMO_BEAST_MODE(1417) = 'City' THEN `City`\nWHEN DOMO_BEAST_MODE(1417) = 'Brand' THEN `Brand`\nWHEN DOMO_BEAST_MODE(1417) = 'Category' THEN `Product Category`\nWHEN DOMO_BEAST_MODE(1417) = 'Department' THEN `Department`\nEND", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 49}, {'columnName': '`State`', 'columnPosition': 100}, {'columnName': '`City`', 'columnPosition': 149}, {'columnName': '`Brand`', 'columnPosition': 198}, {'columnName': '`Product Category`', 'columnPosition': 251}, {'columnName': '`Department`', 'columnPosition': 317}], 'variable': False}, 'calculation_b164f721-711f-4067-a913-ddd2250006fa': {'templateId': 1392, 'id': 'calculation_b164f721-711f-4067-a913-ddd2250006fa', 'name': 'BM Date range 1', 'formula': 'CASE \n\tWHEN `Updated Order Date` >= DOMO_BEAST_MODE(1388)AND `Updated Order Date` <= DOMO_BEAST_MODE(1387) THEN `Total Sales`\n    ELSE 0\nEND', 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 12}, {'columnName': '`Updated Order Date`', 'columnPosition': 61}, {'columnName': '`Total Sales`', 'columnPosition': 112}], 'variable': False}, 'calculation_49b9974d-71d3-49c0-823b-44742adbc6b2': {'templateId': 1434, 'id': 'calculation_49b9974d-71d3-49c0-823b-44742adbc6b2', 'name': 'Current Time Range (Level 2)', 'formula': "(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN \n \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n  \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n              WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 174}, {'columnName': '`Updated Order Date`', 'columnPosition': 210}, {'columnName': '`Total Sales`', 'columnPosition': 261}, {'columnName': '`Updated Order Date`', 'columnPosition': 429}, {'columnName': '`Updated Order Date`', 'columnPosition': 478}, {'columnName': '`Updated Order Date`', 'columnPosition': 514}, {'columnName': '`Total Sales`', 'columnPosition': 565}, {'columnName': '`Updated Order Date`', 'columnPosition': 731}, {'columnName': '`Updated Order Date`', 'columnPosition': 782}, {'columnName': '`Updated Order Date`', 'columnPosition': 819}, {'columnName': '`Total Sales`', 'columnPosition': 870}, {'columnName': '`Updated Order Date`', 'columnPosition': 1033}, {'columnName': '`Updated Order Date`', 'columnPosition': 1082}, {'columnName': '`Updated Order Date`', 'columnPosition': 1118}, {'columnName': '`Total Sales`', 'columnPosition': 1169}, {'columnName': '`Updated Order Date`', 'columnPosition': 1397}, {'columnName': '`Updated Order Date`', 'columnPosition': 1433}, {'columnName': '`Total Sales`', 'columnPosition': 1483}, {'columnName': '`Updated Order Date`', 'columnPosition': 1651}, {'columnName': '`Updated Order Date`', 'columnPosition': 1700}, {'columnName': '`Updated Order Date`', 'columnPosition': 1736}, {'columnName': '`Total Sales`', 'columnPosition': 1786}, {'columnName': '`Updated Order Date`', 'columnPosition': 1950}, {'columnName': '`Updated Order Date`', 'columnPosition': 1999}, {'columnName': '`Updated Order Date`', 'columnPosition': 2035}, {'columnName': '`Total Sales`', 'columnPosition': 2085}, {'columnName': '`Updated Order Date`', 'columnPosition': 2247}, {'columnName': '`Updated Order Date`', 'columnPosition': 2296}, {'columnName': '`Updated Order Date`', 'columnPosition': 2332}, {'columnName': '`Total Sales`', 'columnPosition': 2382}], 'variable': False}, 'calculation_54823e72-0ae9-48fc-8d3f-56a6dea5c9b2': {'templateId': 1433, 'id': 'calculation_54823e72-0ae9-48fc-8d3f-56a6dea5c9b2', 'name': 'Current Time Range (Level 1)', 'formula': "(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n     (CASE\n        WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n        ELSE 0\n      END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n     (CASE\n        WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n        ELSE 0\n      END)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 100}, {'columnName': '`Updated Order Date`', 'columnPosition': 149}, {'columnName': '`Updated Order Date`', 'columnPosition': 185}, {'columnName': '`Total Sales`', 'columnPosition': 236}, {'columnName': '`Updated Order Date`', 'columnPosition': 365}, {'columnName': '`Updated Order Date`', 'columnPosition': 414}, {'columnName': '`Updated Order Date`', 'columnPosition': 450}, {'columnName': '`Total Sales`', 'columnPosition': 500}], 'variable': False}, 'calculation_56366fc1-4a4d-4488-aa31-b5ec831abe46': {'templateId': 1422, 'id': 'calculation_56366fc1-4a4d-4488-aa31-b5ec831abe46', 'name': 'Table group 2', 'formula': "CASE \nWHEN DOMO_BEAST_MODE(1420) = 'Region' then `Region`\nWHEN DOMO_BEAST_MODE(1420) = 'State' then `State`\nWHEN DOMO_BEAST_MODE(1420) = 'City' THEN `City`\nWHEN DOMO_BEAST_MODE(1420)= 'Brand' THEN `Brand`\nWHEN DOMO_BEAST_MODE(1420)= 'Category' THEN `Product Category`\nWHEN DOMO_BEAST_MODE(1420) = 'Department' THEN `Department`\nEND", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 49}, {'columnName': '`State`', 'columnPosition': 100}, {'columnName': '`City`', 'columnPosition': 149}, {'columnName': '`Brand`', 'columnPosition': 197}, {'columnName': '`Product Category`', 'columnPosition': 249}, {'columnName': '`Department`', 'columnPosition': 315}], 'variable': False}, 'calculation_17659306-e312-4bee-8fbb-a677c3c7bdde': {'templateId': 1393, 'id': 'calculation_17659306-e312-4bee-8fbb-a677c3c7bdde', 'name': '% Diff (Custom Dates)', 'formula': 'SUM(CASE \n\tWHEN `Updated Order Date` >= DOMO_BEAST_MODE(1388) AND `Updated Order Date` <= DOMO_BEAST_MODE(1387) THEN `Total Sales`\n    ELSE 0\nEND)\n/\nSUM(CASE \n\tWHEN `Updated Order Date` >= DOMO_BEAST_MODE(1390) AND `Updated Order Date` <= DOMO_BEAST_MODE(1389) THEN `Total Sales`\n    ELSE 0\nEND)\n-1', 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 16}, {'columnName': '`Updated Order Date`', 'columnPosition': 66}, {'columnName': '`Total Sales`', 'columnPosition': 117}, {'columnName': '`Updated Order Date`', 'columnPosition': 165}, {'columnName': '`Updated Order Date`', 'columnPosition': 215}, {'columnName': '`Total Sales`', 'columnPosition': 266}], 'variable': False}, 'calculation_5e32fd2d-3c08-4d07-aeb1-8f9921e7ab66': {'templateId': 1439, 'id': 'calculation_5e32fd2d-3c08-4d07-aeb1-8f9921e7ab66', 'name': 'Current Time Range (Level 3)', 'formula': "(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN \n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n  \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n              WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 174}, {'columnName': '`Updated Order Date`', 'columnPosition': 210}, {'columnName': '`Total Sales`', 'columnPosition': 261}, {'columnName': '`Updated Order Date`', 'columnPosition': 429}, {'columnName': '`Updated Order Date`', 'columnPosition': 478}, {'columnName': '`Updated Order Date`', 'columnPosition': 514}, {'columnName': '`Total Sales`', 'columnPosition': 565}, {'columnName': '`Updated Order Date`', 'columnPosition': 731}, {'columnName': '`Updated Order Date`', 'columnPosition': 782}, {'columnName': '`Updated Order Date`', 'columnPosition': 819}, {'columnName': '`Total Sales`', 'columnPosition': 870}, {'columnName': '`Updated Order Date`', 'columnPosition': 1033}, {'columnName': '`Updated Order Date`', 'columnPosition': 1082}, {'columnName': '`Updated Order Date`', 'columnPosition': 1118}, {'columnName': '`Total Sales`', 'columnPosition': 1169}, {'columnName': '`Updated Order Date`', 'columnPosition': 1397}, {'columnName': '`Updated Order Date`', 'columnPosition': 1433}, {'columnName': '`Total Sales`', 'columnPosition': 1483}, {'columnName': '`Updated Order Date`', 'columnPosition': 1651}, {'columnName': '`Updated Order Date`', 'columnPosition': 1700}, {'columnName': '`Updated Order Date`', 'columnPosition': 1736}, {'columnName': '`Total Sales`', 'columnPosition': 1786}, {'columnName': '`Updated Order Date`', 'columnPosition': 1950}, {'columnName': '`Updated Order Date`', 'columnPosition': 1999}, {'columnName': '`Updated Order Date`', 'columnPosition': 2035}, {'columnName': '`Total Sales`', 'columnPosition': 2085}, {'columnName': '`Updated Order Date`', 'columnPosition': 2247}, {'columnName': '`Updated Order Date`', 'columnPosition': 2296}, {'columnName': '`Updated Order Date`', 'columnPosition': 2332}, {'columnName': '`Total Sales`', 'columnPosition': 2382}], 'variable': False}, 'calculation_ac350511-cdbd-4a7a-a0cd-7082c735c054': {'templateId': 1437, 'id': 'calculation_ac350511-cdbd-4a7a-a0cd-7082c735c054', 'name': '% Diff (Level 3)', 'formula': "SUM(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n  \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n              WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\nEND)\n/\nSUM(CASE \n\tWHEN DOMO_BEAST_MODE(1364) = 'YoY' THEN\n      (CASE   \t\n         WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n          WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n       END)\n     WHEN DOMO_BEAST_MODE(1364) = 'PoP' THEN\n \t\t(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n            WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)\nEND)\n-1", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 176}, {'columnName': '`Updated Order Date`', 'columnPosition': 212}, {'columnName': '`Total Sales`', 'columnPosition': 263}, {'columnName': '`Updated Order Date`', 'columnPosition': 431}, {'columnName': '`Updated Order Date`', 'columnPosition': 480}, {'columnName': '`Updated Order Date`', 'columnPosition': 516}, {'columnName': '`Total Sales`', 'columnPosition': 567}, {'columnName': '`Updated Order Date`', 'columnPosition': 733}, {'columnName': '`Updated Order Date`', 'columnPosition': 784}, {'columnName': '`Updated Order Date`', 'columnPosition': 821}, {'columnName': '`Total Sales`', 'columnPosition': 872}, {'columnName': '`Updated Order Date`', 'columnPosition': 1035}, {'columnName': '`Updated Order Date`', 'columnPosition': 1084}, {'columnName': '`Updated Order Date`', 'columnPosition': 1120}, {'columnName': '`Total Sales`', 'columnPosition': 1171}, {'columnName': '`Updated Order Date`', 'columnPosition': 1399}, {'columnName': '`Updated Order Date`', 'columnPosition': 1435}, {'columnName': '`Total Sales`', 'columnPosition': 1485}, {'columnName': '`Updated Order Date`', 'columnPosition': 1653}, {'columnName': '`Updated Order Date`', 'columnPosition': 1702}, {'columnName': '`Updated Order Date`', 'columnPosition': 1738}, {'columnName': '`Total Sales`', 'columnPosition': 1788}, {'columnName': '`Updated Order Date`', 'columnPosition': 1952}, {'columnName': '`Updated Order Date`', 'columnPosition': 2001}, {'columnName': '`Updated Order Date`', 'columnPosition': 2037}, {'columnName': '`Total Sales`', 'columnPosition': 2087}, {'columnName': '`Updated Order Date`', 'columnPosition': 2249}, {'columnName': '`Updated Order Date`', 'columnPosition': 2298}, {'columnName': '`Updated Order Date`', 'columnPosition': 2334}, {'columnName': '`Total Sales`', 'columnPosition': 2384}, {'columnName': '`Updated Order Date`', 'columnPosition': 2720}, {'columnName': '`Updated Order Date`', 'columnPosition': 2756}, {'columnName': '`Total Sales`', 'columnPosition': 2807}, {'columnName': '`Updated Order Date`', 'columnPosition': 3005}, {'columnName': '`Updated Order Date`', 'columnPosition': 3056}, {'columnName': '`Updated Order Date`', 'columnPosition': 3092}, {'columnName': '`Total Sales`', 'columnPosition': 3143}, {'columnName': '`Updated Order Date`', 'columnPosition': 3337}, {'columnName': '`Updated Order Date`', 'columnPosition': 3388}, {'columnName': '`Updated Order Date`', 'columnPosition': 3425}, {'columnName': '`Total Sales`', 'columnPosition': 3477}, {'columnName': '`Updated Order Date`', 'columnPosition': 3669}, {'columnName': '`Updated Order Date`', 'columnPosition': 3720}, {'columnName': '`Updated Order Date`', 'columnPosition': 3756}, {'columnName': '`Total Sales`', 'columnPosition': 3807}, {'columnName': '`Updated Order Date`', 'columnPosition': 4087}, {'columnName': '`Updated Order Date`', 'columnPosition': 4123}, {'columnName': '`Total Sales`', 'columnPosition': 4173}, {'columnName': '`Updated Order Date`', 'columnPosition': 4371}, {'columnName': '`Updated Order Date`', 'columnPosition': 4422}, {'columnName': '`Updated Order Date`', 'columnPosition': 4458}, {'columnName': '`Total Sales`', 'columnPosition': 4508}, {'columnName': '`Updated Order Date`', 'columnPosition': 4702}, {'columnName': '`Updated Order Date`', 'columnPosition': 4753}, {'columnName': '`Updated Order Date`', 'columnPosition': 4790}, {'columnName': '`Total Sales`', 'columnPosition': 4841}, {'columnName': '`Updated Order Date`', 'columnPosition': 5033}, {'columnName': '`Updated Order Date`', 'columnPosition': 5084}, {'columnName': '`Updated Order Date`', 'columnPosition': 5120}, {'columnName': '`Total Sales`', 'columnPosition': 5170}, {'columnName': '`Updated Order Date`', 'columnPosition': 5529}, {'columnName': '`Updated Order Date`', 'columnPosition': 5565}, {'columnName': '`Total Sales`', 'columnPosition': 5616}, {'columnName': '`Updated Order Date`', 'columnPosition': 5890}, {'columnName': '`Updated Order Date`', 'columnPosition': 5945}, {'columnName': '`Updated Order Date`', 'columnPosition': 5978}, {'columnName': '`Updated Order Date`', 'columnPosition': 6042}, {'columnName': '`Total Sales`', 'columnPosition': 6094}, {'columnName': '`Updated Order Date`', 'columnPosition': 6227}, {'columnName': '`Updated Order Date`', 'columnPosition': 6276}, {'columnName': '`Updated Order Date`', 'columnPosition': 6309}, {'columnName': '`Updated Order Date`', 'columnPosition': 6373}, {'columnName': '`Total Sales`', 'columnPosition': 6425}, {'columnName': '`Updated Order Date`', 'columnPosition': 6693}, {'columnName': '`Updated Order Date`', 'columnPosition': 6749}, {'columnName': '`Updated Order Date`', 'columnPosition': 6786}, {'columnName': '`Total Sales`', 'columnPosition': 6838}, {'columnName': '`Updated Order Date`', 'columnPosition': 6967}, {'columnName': '`Updated Order Date`', 'columnPosition': 7016}, {'columnName': '`Updated Order Date`', 'columnPosition': 7053}, {'columnName': '`Total Sales`', 'columnPosition': 7105}, {'columnName': '`Updated Order Date`', 'columnPosition': 7371}, {'columnName': '`Updated Order Date`', 'columnPosition': 7427}, {'columnName': '`Updated Order Date`', 'columnPosition': 7463}, {'columnName': '`Total Sales`', 'columnPosition': 7514}, {'columnName': '`Updated Order Date`', 'columnPosition': 7639}, {'columnName': '`Updated Order Date`', 'columnPosition': 7690}, {'columnName': '`Updated Order Date`', 'columnPosition': 7726}, {'columnName': '`Total Sales`', 'columnPosition': 7777}, {'columnName': '`Updated Order Date`', 'columnPosition': 8070}, {'columnName': '`Updated Order Date`', 'columnPosition': 8106}, {'columnName': '`Total Sales`', 'columnPosition': 8156}, {'columnName': '`Updated Order Date`', 'columnPosition': 8430}, {'columnName': '`Updated Order Date`', 'columnPosition': 8485}, {'columnName': '`Updated Order Date`', 'columnPosition': 8518}, {'columnName': '`Updated Order Date`', 'columnPosition': 8582}, {'columnName': '`Total Sales`', 'columnPosition': 8633}, {'columnName': '`Updated Order Date`', 'columnPosition': 8766}, {'columnName': '`Updated Order Date`', 'columnPosition': 8815}, {'columnName': '`Updated Order Date`', 'columnPosition': 8848}, {'columnName': '`Updated Order Date`', 'columnPosition': 8912}, {'columnName': '`Total Sales`', 'columnPosition': 8963}, {'columnName': '`Updated Order Date`', 'columnPosition': 9231}, {'columnName': '`Updated Order Date`', 'columnPosition': 9287}, {'columnName': '`Updated Order Date`', 'columnPosition': 9324}, {'columnName': '`Total Sales`', 'columnPosition': 9375}, {'columnName': '`Updated Order Date`', 'columnPosition': 9504}, {'columnName': '`Updated Order Date`', 'columnPosition': 9553}, {'columnName': '`Updated Order Date`', 'columnPosition': 9590}, {'columnName': '`Total Sales`', 'columnPosition': 9641}, {'columnName': '`Updated Order Date`', 'columnPosition': 9907}, {'columnName': '`Updated Order Date`', 'columnPosition': 9963}, {'columnName': '`Updated Order Date`', 'columnPosition': 9999}, {'columnName': '`Total Sales`', 'columnPosition': 10049}, {'columnName': '`Updated Order Date`', 'columnPosition': 10174}, {'columnName': '`Updated Order Date`', 'columnPosition': 10225}, {'columnName': '`Updated Order Date`', 'columnPosition': 10261}, {'columnName': '`Total Sales`', 'columnPosition': 10311}], 'variable': False}, 'calculation_bbe81bf4-dd79-4c35-93fd-a6ea17e1bfb2': {'templateId': 1367, 'id': 'calculation_bbe81bf4-dd79-4c35-93fd-a6ea17e1bfb2', 'name': 'Brand groups', 'formula': "(CASE WHEN (`Brand` = 'Nike') THEN 'Nike Footwear' WHEN (`Brand` = 'Adidas') THEN 'Adidas Footwear' ELSE 'Market share' END)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Brand`', 'columnPosition': 12}, {'columnName': '`Brand`', 'columnPosition': 57}], 'variable': False}, 'calculation_7e820e1a-1573-4baf-83eb-35505194110e': {'templateId': 2520, 'id': 'calculation_7e820e1a-1573-4baf-83eb-35505194110e', 'name': 'Comparison Time Range (Level 4)', 'formula': "(CASE \n\tWHEN DOMO_BEAST_MODE(1364) = 'YoY' THEN \n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n       END)\n     WHEN DOMO_BEAST_MODE(1364) = 'PoP' THEN\n \t\t(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                        \tTHEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                    \tTHEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE())-1 = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 197}, {'columnName': '`Updated Order Date`', 'columnPosition': 233}, {'columnName': '`Total Sales`', 'columnPosition': 284}, {'columnName': '`Updated Order Date`', 'columnPosition': 482}, {'columnName': '`Updated Order Date`', 'columnPosition': 533}, {'columnName': '`Updated Order Date`', 'columnPosition': 569}, {'columnName': '`Total Sales`', 'columnPosition': 620}, {'columnName': '`Updated Order Date`', 'columnPosition': 814}, {'columnName': '`Updated Order Date`', 'columnPosition': 865}, {'columnName': '`Updated Order Date`', 'columnPosition': 902}, {'columnName': '`Total Sales`', 'columnPosition': 954}, {'columnName': '`Updated Order Date`', 'columnPosition': 1146}, {'columnName': '`Updated Order Date`', 'columnPosition': 1197}, {'columnName': '`Updated Order Date`', 'columnPosition': 1233}, {'columnName': '`Total Sales`', 'columnPosition': 1284}, {'columnName': '`Updated Order Date`', 'columnPosition': 1624}, {'columnName': '`Updated Order Date`', 'columnPosition': 1660}, {'columnName': '`Total Sales`', 'columnPosition': 1711}, {'columnName': '`Updated Order Date`', 'columnPosition': 1985}, {'columnName': '`Updated Order Date`', 'columnPosition': 2040}, {'columnName': '`Updated Order Date`', 'columnPosition': 2073}, {'columnName': '`Updated Order Date`', 'columnPosition': 2205}, {'columnName': '`Updated Order Date`', 'columnPosition': 2246}, {'columnName': '`Updated Order Date`', 'columnPosition': 2280}, {'columnName': '`Updated Order Date`', 'columnPosition': 2364}, {'columnName': '`Updated Order Date`', 'columnPosition': 2405}, {'columnName': '`Updated Order Date`', 'columnPosition': 2439}, {'columnName': '`Updated Order Date`', 'columnPosition': 2523}, {'columnName': '`Updated Order Date`', 'columnPosition': 2564}, {'columnName': '`Updated Order Date`', 'columnPosition': 2598}, {'columnName': '`Updated Order Date`', 'columnPosition': 2685}, {'columnName': '`Updated Order Date`', 'columnPosition': 2719}, {'columnName': '`Total Sales`', 'columnPosition': 3363}, {'columnName': '`Updated Order Date`', 'columnPosition': 3496}, {'columnName': '`Updated Order Date`', 'columnPosition': 3545}, {'columnName': '`Updated Order Date`', 'columnPosition': 3578}, {'columnName': '`Updated Order Date`', 'columnPosition': 3710}, {'columnName': '`Updated Order Date`', 'columnPosition': 3751}, {'columnName': '`Updated Order Date`', 'columnPosition': 3785}, {'columnName': '`Updated Order Date`', 'columnPosition': 3869}, {'columnName': '`Updated Order Date`', 'columnPosition': 3910}, {'columnName': '`Updated Order Date`', 'columnPosition': 3944}, {'columnName': '`Updated Order Date`', 'columnPosition': 4028}, {'columnName': '`Updated Order Date`', 'columnPosition': 4069}, {'columnName': '`Updated Order Date`', 'columnPosition': 4103}, {'columnName': '`Updated Order Date`', 'columnPosition': 4190}, {'columnName': '`Updated Order Date`', 'columnPosition': 4224}, {'columnName': '`Total Sales`', 'columnPosition': 4864}, {'columnName': '`Updated Order Date`', 'columnPosition': 5132}, {'columnName': '`Updated Order Date`', 'columnPosition': 5188}, {'columnName': '`Updated Order Date`', 'columnPosition': 5225}, {'columnName': '`Total Sales`', 'columnPosition': 5277}, {'columnName': '`Updated Order Date`', 'columnPosition': 5406}, {'columnName': '`Updated Order Date`', 'columnPosition': 5455}, {'columnName': '`Updated Order Date`', 'columnPosition': 5492}, {'columnName': '`Total Sales`', 'columnPosition': 5544}, {'columnName': '`Updated Order Date`', 'columnPosition': 5810}, {'columnName': '`Updated Order Date`', 'columnPosition': 5866}, {'columnName': '`Updated Order Date`', 'columnPosition': 5902}, {'columnName': '`Total Sales`', 'columnPosition': 5953}, {'columnName': '`Updated Order Date`', 'columnPosition': 6080}, {'columnName': '`Updated Order Date`', 'columnPosition': 6129}, {'columnName': '`Updated Order Date`', 'columnPosition': 6165}, {'columnName': '`Total Sales`', 'columnPosition': 6216}], 'variable': False}, 'calculation_a4421ccf-525a-49dd-8dec-25f7267b50f3': {'templateId': 1438, 'id': 'calculation_a4421ccf-525a-49dd-8dec-25f7267b50f3', 'name': 'Comparison Time Range (Level 3)', 'formula': "(CASE \n\tWHEN DOMO_BEAST_MODE(1364) = 'YoY' THEN \n      (CASE   \t\n         WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n          WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n       END)\n     WHEN DOMO_BEAST_MODE(1364) = 'PoP' THEN\n \t\t(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n            WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 262}, {'columnName': '`Updated Order Date`', 'columnPosition': 298}, {'columnName': '`Total Sales`', 'columnPosition': 349}, {'columnName': '`Updated Order Date`', 'columnPosition': 547}, {'columnName': '`Updated Order Date`', 'columnPosition': 598}, {'columnName': '`Updated Order Date`', 'columnPosition': 634}, {'columnName': '`Total Sales`', 'columnPosition': 685}, {'columnName': '`Updated Order Date`', 'columnPosition': 879}, {'columnName': '`Updated Order Date`', 'columnPosition': 930}, {'columnName': '`Updated Order Date`', 'columnPosition': 967}, {'columnName': '`Total Sales`', 'columnPosition': 1019}, {'columnName': '`Updated Order Date`', 'columnPosition': 1211}, {'columnName': '`Updated Order Date`', 'columnPosition': 1262}, {'columnName': '`Updated Order Date`', 'columnPosition': 1298}, {'columnName': '`Total Sales`', 'columnPosition': 1349}, {'columnName': '`Updated Order Date`', 'columnPosition': 1629}, {'columnName': '`Updated Order Date`', 'columnPosition': 1665}, {'columnName': '`Total Sales`', 'columnPosition': 1715}, {'columnName': '`Updated Order Date`', 'columnPosition': 1913}, {'columnName': '`Updated Order Date`', 'columnPosition': 1964}, {'columnName': '`Updated Order Date`', 'columnPosition': 2000}, {'columnName': '`Total Sales`', 'columnPosition': 2050}, {'columnName': '`Updated Order Date`', 'columnPosition': 2244}, {'columnName': '`Updated Order Date`', 'columnPosition': 2295}, {'columnName': '`Updated Order Date`', 'columnPosition': 2332}, {'columnName': '`Total Sales`', 'columnPosition': 2383}, {'columnName': '`Updated Order Date`', 'columnPosition': 2575}, {'columnName': '`Updated Order Date`', 'columnPosition': 2626}, {'columnName': '`Updated Order Date`', 'columnPosition': 2662}, {'columnName': '`Total Sales`', 'columnPosition': 2712}, {'columnName': '`Updated Order Date`', 'columnPosition': 3071}, {'columnName': '`Updated Order Date`', 'columnPosition': 3107}, {'columnName': '`Total Sales`', 'columnPosition': 3158}, {'columnName': '`Updated Order Date`', 'columnPosition': 3432}, {'columnName': '`Updated Order Date`', 'columnPosition': 3487}, {'columnName': '`Updated Order Date`', 'columnPosition': 3520}, {'columnName': '`Updated Order Date`', 'columnPosition': 3584}, {'columnName': '`Total Sales`', 'columnPosition': 3636}, {'columnName': '`Updated Order Date`', 'columnPosition': 3769}, {'columnName': '`Updated Order Date`', 'columnPosition': 3818}, {'columnName': '`Updated Order Date`', 'columnPosition': 3851}, {'columnName': '`Updated Order Date`', 'columnPosition': 3915}, {'columnName': '`Total Sales`', 'columnPosition': 3967}, {'columnName': '`Updated Order Date`', 'columnPosition': 4235}, {'columnName': '`Updated Order Date`', 'columnPosition': 4291}, {'columnName': '`Updated Order Date`', 'columnPosition': 4328}, {'columnName': '`Total Sales`', 'columnPosition': 4380}, {'columnName': '`Updated Order Date`', 'columnPosition': 4509}, {'columnName': '`Updated Order Date`', 'columnPosition': 4558}, {'columnName': '`Updated Order Date`', 'columnPosition': 4595}, {'columnName': '`Total Sales`', 'columnPosition': 4647}, {'columnName': '`Updated Order Date`', 'columnPosition': 4913}, {'columnName': '`Updated Order Date`', 'columnPosition': 4969}, {'columnName': '`Updated Order Date`', 'columnPosition': 5005}, {'columnName': '`Total Sales`', 'columnPosition': 5056}, {'columnName': '`Updated Order Date`', 'columnPosition': 5181}, {'columnName': '`Updated Order Date`', 'columnPosition': 5232}, {'columnName': '`Updated Order Date`', 'columnPosition': 5268}, {'columnName': '`Total Sales`', 'columnPosition': 5319}, {'columnName': '`Updated Order Date`', 'columnPosition': 5612}, {'columnName': '`Updated Order Date`', 'columnPosition': 5648}, {'columnName': '`Total Sales`', 'columnPosition': 5698}, {'columnName': '`Updated Order Date`', 'columnPosition': 5972}, {'columnName': '`Updated Order Date`', 'columnPosition': 6027}, {'columnName': '`Updated Order Date`', 'columnPosition': 6060}, {'columnName': '`Updated Order Date`', 'columnPosition': 6124}, {'columnName': '`Total Sales`', 'columnPosition': 6175}, {'columnName': '`Updated Order Date`', 'columnPosition': 6308}, {'columnName': '`Updated Order Date`', 'columnPosition': 6357}, {'columnName': '`Updated Order Date`', 'columnPosition': 6390}, {'columnName': '`Updated Order Date`', 'columnPosition': 6454}, {'columnName': '`Total Sales`', 'columnPosition': 6505}, {'columnName': '`Updated Order Date`', 'columnPosition': 6773}, {'columnName': '`Updated Order Date`', 'columnPosition': 6829}, {'columnName': '`Updated Order Date`', 'columnPosition': 6866}, {'columnName': '`Total Sales`', 'columnPosition': 6917}, {'columnName': '`Updated Order Date`', 'columnPosition': 7046}, {'columnName': '`Updated Order Date`', 'columnPosition': 7095}, {'columnName': '`Updated Order Date`', 'columnPosition': 7132}, {'columnName': '`Total Sales`', 'columnPosition': 7183}, {'columnName': '`Updated Order Date`', 'columnPosition': 7449}, {'columnName': '`Updated Order Date`', 'columnPosition': 7505}, {'columnName': '`Updated Order Date`', 'columnPosition': 7541}, {'columnName': '`Total Sales`', 'columnPosition': 7591}, {'columnName': '`Updated Order Date`', 'columnPosition': 7716}, {'columnName': '`Updated Order Date`', 'columnPosition': 7767}, {'columnName': '`Updated Order Date`', 'columnPosition': 7803}, {'columnName': '`Total Sales`', 'columnPosition': 7853}], 'variable': False}, 'calculation_aa297a85-84ac-4354-8b10-314b9c334927': {'templateId': 1381, 'id': 'calculation_aa297a85-84ac-4354-8b10-314b9c334927', 'name': 'Unique product id', 'formula': 'COUNT(DISTINCT `Product Name` )', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Product Name`', 'columnPosition': 15}], 'variable': False}, 'calculation_0e160a67-c68e-44aa-b21a-1af53a321c9d': {'templateId': 2519, 'id': 'calculation_0e160a67-c68e-44aa-b21a-1af53a321c9d', 'name': 'Current Time Range (Level 4)', 'formula': "(CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN \n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 117}, {'columnName': '`Updated Order Date`', 'columnPosition': 153}, {'columnName': '`Total Sales`', 'columnPosition': 204}, {'columnName': '`Updated Order Date`', 'columnPosition': 372}, {'columnName': '`Updated Order Date`', 'columnPosition': 421}, {'columnName': '`Updated Order Date`', 'columnPosition': 457}, {'columnName': '`Total Sales`', 'columnPosition': 508}, {'columnName': '`Updated Order Date`', 'columnPosition': 674}, {'columnName': '`Updated Order Date`', 'columnPosition': 725}, {'columnName': '`Updated Order Date`', 'columnPosition': 762}, {'columnName': '`Total Sales`', 'columnPosition': 813}, {'columnName': '`Updated Order Date`', 'columnPosition': 976}, {'columnName': '`Updated Order Date`', 'columnPosition': 1025}, {'columnName': '`Updated Order Date`', 'columnPosition': 1061}, {'columnName': '`Total Sales`', 'columnPosition': 1112}], 'variable': False}, 'calculation_94fa0dba-cdf7-4940-9c2a-760ada807896': {'templateId': 2521, 'id': 'calculation_94fa0dba-cdf7-4940-9c2a-760ada807896', 'name': '% Diff (Level 4)', 'formula': "SUM(CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN \n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\nEND)\n/\nSUM(CASE \n\tWHEN DOMO_BEAST_MODE(1364) = 'YoY' THEN \n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n       END)\n     WHEN DOMO_BEAST_MODE(1364) = 'PoP' THEN\n \t\t(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                        \tTHEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                    \tTHEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE())-1 = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 120}, {'columnName': '`Updated Order Date`', 'columnPosition': 156}, {'columnName': '`Total Sales`', 'columnPosition': 207}, {'columnName': '`Updated Order Date`', 'columnPosition': 375}, {'columnName': '`Updated Order Date`', 'columnPosition': 424}, {'columnName': '`Updated Order Date`', 'columnPosition': 460}, {'columnName': '`Total Sales`', 'columnPosition': 511}, {'columnName': '`Updated Order Date`', 'columnPosition': 677}, {'columnName': '`Updated Order Date`', 'columnPosition': 728}, {'columnName': '`Updated Order Date`', 'columnPosition': 765}, {'columnName': '`Total Sales`', 'columnPosition': 816}, {'columnName': '`Updated Order Date`', 'columnPosition': 979}, {'columnName': '`Updated Order Date`', 'columnPosition': 1028}, {'columnName': '`Updated Order Date`', 'columnPosition': 1064}, {'columnName': '`Total Sales`', 'columnPosition': 1115}, {'columnName': '`Updated Order Date`', 'columnPosition': 1374}, {'columnName': '`Updated Order Date`', 'columnPosition': 1410}, {'columnName': '`Total Sales`', 'columnPosition': 1461}, {'columnName': '`Updated Order Date`', 'columnPosition': 1659}, {'columnName': '`Updated Order Date`', 'columnPosition': 1710}, {'columnName': '`Updated Order Date`', 'columnPosition': 1746}, {'columnName': '`Total Sales`', 'columnPosition': 1797}, {'columnName': '`Updated Order Date`', 'columnPosition': 1991}, {'columnName': '`Updated Order Date`', 'columnPosition': 2042}, {'columnName': '`Updated Order Date`', 'columnPosition': 2079}, {'columnName': '`Total Sales`', 'columnPosition': 2131}, {'columnName': '`Updated Order Date`', 'columnPosition': 2323}, {'columnName': '`Updated Order Date`', 'columnPosition': 2374}, {'columnName': '`Updated Order Date`', 'columnPosition': 2410}, {'columnName': '`Total Sales`', 'columnPosition': 2461}, {'columnName': '`Updated Order Date`', 'columnPosition': 2801}, {'columnName': '`Updated Order Date`', 'columnPosition': 2837}, {'columnName': '`Total Sales`', 'columnPosition': 2888}, {'columnName': '`Updated Order Date`', 'columnPosition': 3162}, {'columnName': '`Updated Order Date`', 'columnPosition': 3217}, {'columnName': '`Updated Order Date`', 'columnPosition': 3250}, {'columnName': '`Updated Order Date`', 'columnPosition': 3382}, {'columnName': '`Updated Order Date`', 'columnPosition': 3423}, {'columnName': '`Updated Order Date`', 'columnPosition': 3457}, {'columnName': '`Updated Order Date`', 'columnPosition': 3541}, {'columnName': '`Updated Order Date`', 'columnPosition': 3582}, {'columnName': '`Updated Order Date`', 'columnPosition': 3616}, {'columnName': '`Updated Order Date`', 'columnPosition': 3700}, {'columnName': '`Updated Order Date`', 'columnPosition': 3741}, {'columnName': '`Updated Order Date`', 'columnPosition': 3775}, {'columnName': '`Updated Order Date`', 'columnPosition': 3862}, {'columnName': '`Updated Order Date`', 'columnPosition': 3896}, {'columnName': '`Total Sales`', 'columnPosition': 4540}, {'columnName': '`Updated Order Date`', 'columnPosition': 4673}, {'columnName': '`Updated Order Date`', 'columnPosition': 4722}, {'columnName': '`Updated Order Date`', 'columnPosition': 4755}, {'columnName': '`Updated Order Date`', 'columnPosition': 4887}, {'columnName': '`Updated Order Date`', 'columnPosition': 4928}, {'columnName': '`Updated Order Date`', 'columnPosition': 4962}, {'columnName': '`Updated Order Date`', 'columnPosition': 5046}, {'columnName': '`Updated Order Date`', 'columnPosition': 5087}, {'columnName': '`Updated Order Date`', 'columnPosition': 5121}, {'columnName': '`Updated Order Date`', 'columnPosition': 5205}, {'columnName': '`Updated Order Date`', 'columnPosition': 5246}, {'columnName': '`Updated Order Date`', 'columnPosition': 5280}, {'columnName': '`Updated Order Date`', 'columnPosition': 5367}, {'columnName': '`Updated Order Date`', 'columnPosition': 5401}, {'columnName': '`Total Sales`', 'columnPosition': 6041}, {'columnName': '`Updated Order Date`', 'columnPosition': 6309}, {'columnName': '`Updated Order Date`', 'columnPosition': 6365}, {'columnName': '`Updated Order Date`', 'columnPosition': 6402}, {'columnName': '`Total Sales`', 'columnPosition': 6454}, {'columnName': '`Updated Order Date`', 'columnPosition': 6583}, {'columnName': '`Updated Order Date`', 'columnPosition': 6632}, {'columnName': '`Updated Order Date`', 'columnPosition': 6669}, {'columnName': '`Total Sales`', 'columnPosition': 6721}, {'columnName': '`Updated Order Date`', 'columnPosition': 6987}, {'columnName': '`Updated Order Date`', 'columnPosition': 7043}, {'columnName': '`Updated Order Date`', 'columnPosition': 7079}, {'columnName': '`Total Sales`', 'columnPosition': 7130}, {'columnName': '`Updated Order Date`', 'columnPosition': 7257}, {'columnName': '`Updated Order Date`', 'columnPosition': 7306}, {'columnName': '`Updated Order Date`', 'columnPosition': 7342}, {'columnName': '`Total Sales`', 'columnPosition': 7393}], 'variable': False}, 'calculation_4a1d1de4-de66-4ceb-9e49-6d1467ade34f': {'templateId': 1370, 'id': 'calculation_4a1d1de4-de66-4ceb-9e49-6d1467ade34f', 'name': '% Diff', 'formula': "SUM(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN \n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n  \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n              WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\nEND)\n/\nSUM(CASE \n\tWHEN DOMO_BEAST_MODE(1364) = 'YoY' THEN \n      (CASE   \t\n         WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n          WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n       END)\n     WHEN DOMO_BEAST_MODE(1364) = 'PoP' THEN\n \t\t(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                        \tTHEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                    \tTHEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE())-1 = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n            WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) < \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                        \tTHEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) < \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                    \tTHEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE())-1 = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)\nEND)\n-1", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 177}, {'columnName': '`Updated Order Date`', 'columnPosition': 213}, {'columnName': '`Total Sales`', 'columnPosition': 264}, {'columnName': '`Updated Order Date`', 'columnPosition': 432}, {'columnName': '`Updated Order Date`', 'columnPosition': 481}, {'columnName': '`Updated Order Date`', 'columnPosition': 517}, {'columnName': '`Total Sales`', 'columnPosition': 568}, {'columnName': '`Updated Order Date`', 'columnPosition': 734}, {'columnName': '`Updated Order Date`', 'columnPosition': 785}, {'columnName': '`Updated Order Date`', 'columnPosition': 822}, {'columnName': '`Total Sales`', 'columnPosition': 873}, {'columnName': '`Updated Order Date`', 'columnPosition': 1036}, {'columnName': '`Updated Order Date`', 'columnPosition': 1085}, {'columnName': '`Updated Order Date`', 'columnPosition': 1121}, {'columnName': '`Total Sales`', 'columnPosition': 1172}, {'columnName': '`Updated Order Date`', 'columnPosition': 1400}, {'columnName': '`Updated Order Date`', 'columnPosition': 1436}, {'columnName': '`Total Sales`', 'columnPosition': 1486}, {'columnName': '`Updated Order Date`', 'columnPosition': 1654}, {'columnName': '`Updated Order Date`', 'columnPosition': 1703}, {'columnName': '`Updated Order Date`', 'columnPosition': 1739}, {'columnName': '`Total Sales`', 'columnPosition': 1789}, {'columnName': '`Updated Order Date`', 'columnPosition': 1953}, {'columnName': '`Updated Order Date`', 'columnPosition': 2002}, {'columnName': '`Updated Order Date`', 'columnPosition': 2038}, {'columnName': '`Total Sales`', 'columnPosition': 2088}, {'columnName': '`Updated Order Date`', 'columnPosition': 2250}, {'columnName': '`Updated Order Date`', 'columnPosition': 2299}, {'columnName': '`Updated Order Date`', 'columnPosition': 2335}, {'columnName': '`Total Sales`', 'columnPosition': 2385}, {'columnName': '`Updated Order Date`', 'columnPosition': 2722}, {'columnName': '`Updated Order Date`', 'columnPosition': 2758}, {'columnName': '`Total Sales`', 'columnPosition': 2809}, {'columnName': '`Updated Order Date`', 'columnPosition': 3007}, {'columnName': '`Updated Order Date`', 'columnPosition': 3058}, {'columnName': '`Updated Order Date`', 'columnPosition': 3094}, {'columnName': '`Total Sales`', 'columnPosition': 3145}, {'columnName': '`Updated Order Date`', 'columnPosition': 3339}, {'columnName': '`Updated Order Date`', 'columnPosition': 3390}, {'columnName': '`Updated Order Date`', 'columnPosition': 3427}, {'columnName': '`Total Sales`', 'columnPosition': 3479}, {'columnName': '`Updated Order Date`', 'columnPosition': 3671}, {'columnName': '`Updated Order Date`', 'columnPosition': 3722}, {'columnName': '`Updated Order Date`', 'columnPosition': 3758}, {'columnName': '`Total Sales`', 'columnPosition': 3809}, {'columnName': '`Updated Order Date`', 'columnPosition': 4089}, {'columnName': '`Updated Order Date`', 'columnPosition': 4125}, {'columnName': '`Total Sales`', 'columnPosition': 4175}, {'columnName': '`Updated Order Date`', 'columnPosition': 4373}, {'columnName': '`Updated Order Date`', 'columnPosition': 4424}, {'columnName': '`Updated Order Date`', 'columnPosition': 4460}, {'columnName': '`Total Sales`', 'columnPosition': 4510}, {'columnName': '`Updated Order Date`', 'columnPosition': 4704}, {'columnName': '`Updated Order Date`', 'columnPosition': 4755}, {'columnName': '`Updated Order Date`', 'columnPosition': 4792}, {'columnName': '`Total Sales`', 'columnPosition': 4843}, {'columnName': '`Updated Order Date`', 'columnPosition': 5035}, {'columnName': '`Updated Order Date`', 'columnPosition': 5086}, {'columnName': '`Updated Order Date`', 'columnPosition': 5122}, {'columnName': '`Total Sales`', 'columnPosition': 5172}, {'columnName': '`Updated Order Date`', 'columnPosition': 5531}, {'columnName': '`Updated Order Date`', 'columnPosition': 5567}, {'columnName': '`Total Sales`', 'columnPosition': 5618}, {'columnName': '`Updated Order Date`', 'columnPosition': 5892}, {'columnName': '`Updated Order Date`', 'columnPosition': 5947}, {'columnName': '`Updated Order Date`', 'columnPosition': 5980}, {'columnName': '`Updated Order Date`', 'columnPosition': 6112}, {'columnName': '`Updated Order Date`', 'columnPosition': 6153}, {'columnName': '`Updated Order Date`', 'columnPosition': 6187}, {'columnName': '`Updated Order Date`', 'columnPosition': 6271}, {'columnName': '`Updated Order Date`', 'columnPosition': 6312}, {'columnName': '`Updated Order Date`', 'columnPosition': 6346}, {'columnName': '`Updated Order Date`', 'columnPosition': 6430}, {'columnName': '`Updated Order Date`', 'columnPosition': 6471}, {'columnName': '`Updated Order Date`', 'columnPosition': 6505}, {'columnName': '`Updated Order Date`', 'columnPosition': 6592}, {'columnName': '`Updated Order Date`', 'columnPosition': 6626}, {'columnName': '`Total Sales`', 'columnPosition': 7270}, {'columnName': '`Updated Order Date`', 'columnPosition': 7403}, {'columnName': '`Updated Order Date`', 'columnPosition': 7452}, {'columnName': '`Updated Order Date`', 'columnPosition': 7485}, {'columnName': '`Updated Order Date`', 'columnPosition': 7617}, {'columnName': '`Updated Order Date`', 'columnPosition': 7658}, {'columnName': '`Updated Order Date`', 'columnPosition': 7692}, {'columnName': '`Updated Order Date`', 'columnPosition': 7776}, {'columnName': '`Updated Order Date`', 'columnPosition': 7817}, {'columnName': '`Updated Order Date`', 'columnPosition': 7851}, {'columnName': '`Updated Order Date`', 'columnPosition': 7935}, {'columnName': '`Updated Order Date`', 'columnPosition': 7976}, {'columnName': '`Updated Order Date`', 'columnPosition': 8010}, {'columnName': '`Updated Order Date`', 'columnPosition': 8097}, {'columnName': '`Updated Order Date`', 'columnPosition': 8131}, {'columnName': '`Total Sales`', 'columnPosition': 8771}, {'columnName': '`Updated Order Date`', 'columnPosition': 9039}, {'columnName': '`Updated Order Date`', 'columnPosition': 9095}, {'columnName': '`Updated Order Date`', 'columnPosition': 9132}, {'columnName': '`Total Sales`', 'columnPosition': 9184}, {'columnName': '`Updated Order Date`', 'columnPosition': 9313}, {'columnName': '`Updated Order Date`', 'columnPosition': 9362}, {'columnName': '`Updated Order Date`', 'columnPosition': 9399}, {'columnName': '`Total Sales`', 'columnPosition': 9451}, {'columnName': '`Updated Order Date`', 'columnPosition': 9717}, {'columnName': '`Updated Order Date`', 'columnPosition': 9773}, {'columnName': '`Updated Order Date`', 'columnPosition': 9809}, {'columnName': '`Total Sales`', 'columnPosition': 9860}, {'columnName': '`Updated Order Date`', 'columnPosition': 9987}, {'columnName': '`Updated Order Date`', 'columnPosition': 10036}, {'columnName': '`Updated Order Date`', 'columnPosition': 10072}, {'columnName': '`Total Sales`', 'columnPosition': 10123}, {'columnName': '`Updated Order Date`', 'columnPosition': 10416}, {'columnName': '`Updated Order Date`', 'columnPosition': 10452}, {'columnName': '`Total Sales`', 'columnPosition': 10502}, {'columnName': '`Updated Order Date`', 'columnPosition': 10776}, {'columnName': '`Updated Order Date`', 'columnPosition': 10831}, {'columnName': '`Updated Order Date`', 'columnPosition': 10864}, {'columnName': '`Updated Order Date`', 'columnPosition': 10996}, {'columnName': '`Updated Order Date`', 'columnPosition': 11037}, {'columnName': '`Updated Order Date`', 'columnPosition': 11071}, {'columnName': '`Updated Order Date`', 'columnPosition': 11155}, {'columnName': '`Updated Order Date`', 'columnPosition': 11196}, {'columnName': '`Updated Order Date`', 'columnPosition': 11230}, {'columnName': '`Updated Order Date`', 'columnPosition': 11314}, {'columnName': '`Updated Order Date`', 'columnPosition': 11355}, {'columnName': '`Updated Order Date`', 'columnPosition': 11389}, {'columnName': '`Updated Order Date`', 'columnPosition': 11476}, {'columnName': '`Updated Order Date`', 'columnPosition': 11510}, {'columnName': '`Total Sales`', 'columnPosition': 12153}, {'columnName': '`Updated Order Date`', 'columnPosition': 12286}, {'columnName': '`Updated Order Date`', 'columnPosition': 12335}, {'columnName': '`Updated Order Date`', 'columnPosition': 12368}, {'columnName': '`Updated Order Date`', 'columnPosition': 12500}, {'columnName': '`Updated Order Date`', 'columnPosition': 12541}, {'columnName': '`Updated Order Date`', 'columnPosition': 12575}, {'columnName': '`Updated Order Date`', 'columnPosition': 12659}, {'columnName': '`Updated Order Date`', 'columnPosition': 12700}, {'columnName': '`Updated Order Date`', 'columnPosition': 12734}, {'columnName': '`Updated Order Date`', 'columnPosition': 12818}, {'columnName': '`Updated Order Date`', 'columnPosition': 12859}, {'columnName': '`Updated Order Date`', 'columnPosition': 12893}, {'columnName': '`Updated Order Date`', 'columnPosition': 12980}, {'columnName': '`Updated Order Date`', 'columnPosition': 13014}, {'columnName': '`Total Sales`', 'columnPosition': 13653}, {'columnName': '`Updated Order Date`', 'columnPosition': 13921}, {'columnName': '`Updated Order Date`', 'columnPosition': 13977}, {'columnName': '`Updated Order Date`', 'columnPosition': 14014}, {'columnName': '`Total Sales`', 'columnPosition': 14065}, {'columnName': '`Updated Order Date`', 'columnPosition': 14194}, {'columnName': '`Updated Order Date`', 'columnPosition': 14243}, {'columnName': '`Updated Order Date`', 'columnPosition': 14280}, {'columnName': '`Total Sales`', 'columnPosition': 14331}, {'columnName': '`Updated Order Date`', 'columnPosition': 14597}, {'columnName': '`Updated Order Date`', 'columnPosition': 14653}, {'columnName': '`Updated Order Date`', 'columnPosition': 14689}, {'columnName': '`Total Sales`', 'columnPosition': 14739}, {'columnName': '`Updated Order Date`', 'columnPosition': 14866}, {'columnName': '`Updated Order Date`', 'columnPosition': 14915}, {'columnName': '`Updated Order Date`', 'columnPosition': 14951}, {'columnName': '`Total Sales`', 'columnPosition': 15001}], 'variable': False}, 'calculation_9c293ee6-0f77-4517-8b62-a530822f3f0c': {'templateId': 1441, 'id': 'calculation_9c293ee6-0f77-4517-8b62-a530822f3f0c', 'name': 'Day of Week', 'formula': 'DAYOFWEEK(`Updated Order Date`)', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 10}], 'variable': False}, 'calculation_ac74c9c7-9ea8-41b4-ab27-613392be454e': {'templateId': 1458, 'id': 'calculation_ac74c9c7-9ea8-41b4-ab27-613392be454e', 'name': 'Fixed Function w/ Variable', 'formula': 'SUM(SUM(`Total Sales`)) FIXED (BY `Region`)*(1-DOMO_BEAST_MODE(1457))', 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 34}, {'columnName': '`Total Sales`', 'columnPosition': 8}], 'variable': False}, 'calculation_66c6ccd1-4b68-4bd7-be6e-b927a6541ea6': {'templateId': 1377, 'id': 'calculation_66c6ccd1-4b68-4bd7-be6e-b927a6541ea6', 'name': 'Web % pen.', 'formula': 'SUM(`Web Sls` )/ SUM(`Total Sales`)', 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Web Sls`', 'columnPosition': 4}, {'columnName': '`Total Sales`', 'columnPosition': 21}], 'variable': False}, 'calculation_c5ebaa5f-621c-4ff3-91c6-88ecd5f6fa1f': {'templateId': 1373, 'id': 'calculation_c5ebaa5f-621c-4ff3-91c6-88ecd5f6fa1f', 'name': 'Comparison Time Range', 'formula': "(CASE \n\tWHEN DOMO_BEAST_MODE(1364) = 'YoY' THEN \n      (CASE   \t\n         WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n          WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n            (CASE\n                WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                  (CASE\n                    WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                  (CASE\n                    WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                  (CASE\n                    WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n                WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                  (CASE\n                    WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                    ELSE 0\n                  END)\n              END)\n       END)\n     WHEN DOMO_BEAST_MODE(1364) = 'PoP' THEN\n \t\t(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                        \tTHEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) <= \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                    \tTHEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE())-1 = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n            WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) < \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                        \tTHEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) AND \n                    \t\t\t  (case\n                                    when month(`Updated Order Date`) <= 3 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-01-01')) + 1\n                                    when month(`Updated Order Date`) <= 6 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-04-01')) + 1\n                                    when month(`Updated Order Date`) <= 9 then datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-07-01')) + 1\n                                    else datediff(`Updated Order Date`, concat(year(`Updated Order Date`),'-10-01')) + 1\n                                  end) < \n                        \t\t  (case\n                                    when month(CURDATE()) <= 3 then datediff(CURDATE(), concat(year(CURDATE()),'-01-01'))\n                                    when month(CURDATE()) <= 6 then datediff(CURDATE(), concat(year(CURDATE()),'-04-01'))\n                                    when month(CURDATE()) <= 9 then datediff(CURDATE(), concat(year(CURDATE()),'-07-01'))\n                                    else datediff(CURDATE(), concat(year(CURDATE()),'-10-01'))\n                                  end)\n                    \tTHEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE())-1 = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)\nEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 262}, {'columnName': '`Updated Order Date`', 'columnPosition': 298}, {'columnName': '`Total Sales`', 'columnPosition': 349}, {'columnName': '`Updated Order Date`', 'columnPosition': 547}, {'columnName': '`Updated Order Date`', 'columnPosition': 598}, {'columnName': '`Updated Order Date`', 'columnPosition': 634}, {'columnName': '`Total Sales`', 'columnPosition': 685}, {'columnName': '`Updated Order Date`', 'columnPosition': 879}, {'columnName': '`Updated Order Date`', 'columnPosition': 930}, {'columnName': '`Updated Order Date`', 'columnPosition': 967}, {'columnName': '`Total Sales`', 'columnPosition': 1019}, {'columnName': '`Updated Order Date`', 'columnPosition': 1211}, {'columnName': '`Updated Order Date`', 'columnPosition': 1262}, {'columnName': '`Updated Order Date`', 'columnPosition': 1298}, {'columnName': '`Total Sales`', 'columnPosition': 1349}, {'columnName': '`Updated Order Date`', 'columnPosition': 1629}, {'columnName': '`Updated Order Date`', 'columnPosition': 1665}, {'columnName': '`Total Sales`', 'columnPosition': 1715}, {'columnName': '`Updated Order Date`', 'columnPosition': 1913}, {'columnName': '`Updated Order Date`', 'columnPosition': 1964}, {'columnName': '`Updated Order Date`', 'columnPosition': 2000}, {'columnName': '`Total Sales`', 'columnPosition': 2050}, {'columnName': '`Updated Order Date`', 'columnPosition': 2244}, {'columnName': '`Updated Order Date`', 'columnPosition': 2295}, {'columnName': '`Updated Order Date`', 'columnPosition': 2332}, {'columnName': '`Total Sales`', 'columnPosition': 2383}, {'columnName': '`Updated Order Date`', 'columnPosition': 2575}, {'columnName': '`Updated Order Date`', 'columnPosition': 2626}, {'columnName': '`Updated Order Date`', 'columnPosition': 2662}, {'columnName': '`Total Sales`', 'columnPosition': 2712}, {'columnName': '`Updated Order Date`', 'columnPosition': 3071}, {'columnName': '`Updated Order Date`', 'columnPosition': 3107}, {'columnName': '`Total Sales`', 'columnPosition': 3158}, {'columnName': '`Updated Order Date`', 'columnPosition': 3432}, {'columnName': '`Updated Order Date`', 'columnPosition': 3487}, {'columnName': '`Updated Order Date`', 'columnPosition': 3520}, {'columnName': '`Updated Order Date`', 'columnPosition': 3652}, {'columnName': '`Updated Order Date`', 'columnPosition': 3693}, {'columnName': '`Updated Order Date`', 'columnPosition': 3727}, {'columnName': '`Updated Order Date`', 'columnPosition': 3811}, {'columnName': '`Updated Order Date`', 'columnPosition': 3852}, {'columnName': '`Updated Order Date`', 'columnPosition': 3886}, {'columnName': '`Updated Order Date`', 'columnPosition': 3970}, {'columnName': '`Updated Order Date`', 'columnPosition': 4011}, {'columnName': '`Updated Order Date`', 'columnPosition': 4045}, {'columnName': '`Updated Order Date`', 'columnPosition': 4132}, {'columnName': '`Updated Order Date`', 'columnPosition': 4166}, {'columnName': '`Total Sales`', 'columnPosition': 4810}, {'columnName': '`Updated Order Date`', 'columnPosition': 4943}, {'columnName': '`Updated Order Date`', 'columnPosition': 4992}, {'columnName': '`Updated Order Date`', 'columnPosition': 5025}, {'columnName': '`Updated Order Date`', 'columnPosition': 5157}, {'columnName': '`Updated Order Date`', 'columnPosition': 5198}, {'columnName': '`Updated Order Date`', 'columnPosition': 5232}, {'columnName': '`Updated Order Date`', 'columnPosition': 5316}, {'columnName': '`Updated Order Date`', 'columnPosition': 5357}, {'columnName': '`Updated Order Date`', 'columnPosition': 5391}, {'columnName': '`Updated Order Date`', 'columnPosition': 5475}, {'columnName': '`Updated Order Date`', 'columnPosition': 5516}, {'columnName': '`Updated Order Date`', 'columnPosition': 5550}, {'columnName': '`Updated Order Date`', 'columnPosition': 5637}, {'columnName': '`Updated Order Date`', 'columnPosition': 5671}, {'columnName': '`Total Sales`', 'columnPosition': 6311}, {'columnName': '`Updated Order Date`', 'columnPosition': 6579}, {'columnName': '`Updated Order Date`', 'columnPosition': 6635}, {'columnName': '`Updated Order Date`', 'columnPosition': 6672}, {'columnName': '`Total Sales`', 'columnPosition': 6724}, {'columnName': '`Updated Order Date`', 'columnPosition': 6853}, {'columnName': '`Updated Order Date`', 'columnPosition': 6902}, {'columnName': '`Updated Order Date`', 'columnPosition': 6939}, {'columnName': '`Total Sales`', 'columnPosition': 6991}, {'columnName': '`Updated Order Date`', 'columnPosition': 7257}, {'columnName': '`Updated Order Date`', 'columnPosition': 7313}, {'columnName': '`Updated Order Date`', 'columnPosition': 7349}, {'columnName': '`Total Sales`', 'columnPosition': 7400}, {'columnName': '`Updated Order Date`', 'columnPosition': 7527}, {'columnName': '`Updated Order Date`', 'columnPosition': 7576}, {'columnName': '`Updated Order Date`', 'columnPosition': 7612}, {'columnName': '`Total Sales`', 'columnPosition': 7663}, {'columnName': '`Updated Order Date`', 'columnPosition': 7956}, {'columnName': '`Updated Order Date`', 'columnPosition': 7992}, {'columnName': '`Total Sales`', 'columnPosition': 8042}, {'columnName': '`Updated Order Date`', 'columnPosition': 8316}, {'columnName': '`Updated Order Date`', 'columnPosition': 8371}, {'columnName': '`Updated Order Date`', 'columnPosition': 8404}, {'columnName': '`Updated Order Date`', 'columnPosition': 8536}, {'columnName': '`Updated Order Date`', 'columnPosition': 8577}, {'columnName': '`Updated Order Date`', 'columnPosition': 8611}, {'columnName': '`Updated Order Date`', 'columnPosition': 8695}, {'columnName': '`Updated Order Date`', 'columnPosition': 8736}, {'columnName': '`Updated Order Date`', 'columnPosition': 8770}, {'columnName': '`Updated Order Date`', 'columnPosition': 8854}, {'columnName': '`Updated Order Date`', 'columnPosition': 8895}, {'columnName': '`Updated Order Date`', 'columnPosition': 8929}, {'columnName': '`Updated Order Date`', 'columnPosition': 9016}, {'columnName': '`Updated Order Date`', 'columnPosition': 9050}, {'columnName': '`Total Sales`', 'columnPosition': 9693}, {'columnName': '`Updated Order Date`', 'columnPosition': 9826}, {'columnName': '`Updated Order Date`', 'columnPosition': 9875}, {'columnName': '`Updated Order Date`', 'columnPosition': 9908}, {'columnName': '`Updated Order Date`', 'columnPosition': 10040}, {'columnName': '`Updated Order Date`', 'columnPosition': 10081}, {'columnName': '`Updated Order Date`', 'columnPosition': 10115}, {'columnName': '`Updated Order Date`', 'columnPosition': 10199}, {'columnName': '`Updated Order Date`', 'columnPosition': 10240}, {'columnName': '`Updated Order Date`', 'columnPosition': 10274}, {'columnName': '`Updated Order Date`', 'columnPosition': 10358}, {'columnName': '`Updated Order Date`', 'columnPosition': 10399}, {'columnName': '`Updated Order Date`', 'columnPosition': 10433}, {'columnName': '`Updated Order Date`', 'columnPosition': 10520}, {'columnName': '`Updated Order Date`', 'columnPosition': 10554}, {'columnName': '`Total Sales`', 'columnPosition': 11193}, {'columnName': '`Updated Order Date`', 'columnPosition': 11461}, {'columnName': '`Updated Order Date`', 'columnPosition': 11517}, {'columnName': '`Updated Order Date`', 'columnPosition': 11554}, {'columnName': '`Total Sales`', 'columnPosition': 11605}, {'columnName': '`Updated Order Date`', 'columnPosition': 11734}, {'columnName': '`Updated Order Date`', 'columnPosition': 11783}, {'columnName': '`Updated Order Date`', 'columnPosition': 11820}, {'columnName': '`Total Sales`', 'columnPosition': 11871}, {'columnName': '`Updated Order Date`', 'columnPosition': 12137}, {'columnName': '`Updated Order Date`', 'columnPosition': 12193}, {'columnName': '`Updated Order Date`', 'columnPosition': 12229}, {'columnName': '`Total Sales`', 'columnPosition': 12279}, {'columnName': '`Updated Order Date`', 'columnPosition': 12406}, {'columnName': '`Updated Order Date`', 'columnPosition': 12455}, {'columnName': '`Updated Order Date`', 'columnPosition': 12491}, {'columnName': '`Total Sales`', 'columnPosition': 12541}], 'variable': False}, 'calculation_61a72fbb-97e0-4370-beea-979151ffbff1': {'templateId': 1426, 'id': 'calculation_61a72fbb-97e0-4370-beea-979151ffbff1', 'name': 'mt-bm-2', 'formula': "CASE WHEN DOMO_BEAST_MODE(1425) = 'Region' THEN `Region` WHEN DOMO_BEAST_MODE(1425) = 'Brand' THEN `Brand` END", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 48}, {'columnName': '`Brand`', 'columnPosition': 99}], 'variable': False}, 'calculation_7c9cb0f7-54d4-472a-ab03-a686eea839a2': {'templateId': 1435, 'id': 'calculation_7c9cb0f7-54d4-472a-ab03-a686eea839a2', 'name': 'Comparison Time Range (Level 2)', 'formula': "(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n            WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 216}, {'columnName': '`Updated Order Date`', 'columnPosition': 252}, {'columnName': '`Total Sales`', 'columnPosition': 303}, {'columnName': '`Updated Order Date`', 'columnPosition': 577}, {'columnName': '`Updated Order Date`', 'columnPosition': 632}, {'columnName': '`Updated Order Date`', 'columnPosition': 665}, {'columnName': '`Total Sales`', 'columnPosition': 719}, {'columnName': '`Updated Order Date`', 'columnPosition': 852}, {'columnName': '`Updated Order Date`', 'columnPosition': 901}, {'columnName': '`Updated Order Date`', 'columnPosition': 934}, {'columnName': '`Total Sales`', 'columnPosition': 988}, {'columnName': '`Updated Order Date`', 'columnPosition': 1256}, {'columnName': '`Updated Order Date`', 'columnPosition': 1312}, {'columnName': '`Updated Order Date`', 'columnPosition': 1349}, {'columnName': '`Total Sales`', 'columnPosition': 1401}, {'columnName': '`Updated Order Date`', 'columnPosition': 1530}, {'columnName': '`Updated Order Date`', 'columnPosition': 1579}, {'columnName': '`Updated Order Date`', 'columnPosition': 1616}, {'columnName': '`Total Sales`', 'columnPosition': 1668}, {'columnName': '`Updated Order Date`', 'columnPosition': 1934}, {'columnName': '`Updated Order Date`', 'columnPosition': 1990}, {'columnName': '`Updated Order Date`', 'columnPosition': 2026}, {'columnName': '`Total Sales`', 'columnPosition': 2077}, {'columnName': '`Updated Order Date`', 'columnPosition': 2202}, {'columnName': '`Updated Order Date`', 'columnPosition': 2253}, {'columnName': '`Updated Order Date`', 'columnPosition': 2289}, {'columnName': '`Total Sales`', 'columnPosition': 2340}, {'columnName': '`Updated Order Date`', 'columnPosition': 2633}, {'columnName': '`Updated Order Date`', 'columnPosition': 2669}, {'columnName': '`Total Sales`', 'columnPosition': 2719}, {'columnName': '`Updated Order Date`', 'columnPosition': 2993}, {'columnName': '`Updated Order Date`', 'columnPosition': 3048}, {'columnName': '`Updated Order Date`', 'columnPosition': 3081}, {'columnName': '`Total Sales`', 'columnPosition': 3135}, {'columnName': '`Updated Order Date`', 'columnPosition': 3268}, {'columnName': '`Updated Order Date`', 'columnPosition': 3317}, {'columnName': '`Updated Order Date`', 'columnPosition': 3350}, {'columnName': '`Total Sales`', 'columnPosition': 3404}, {'columnName': '`Updated Order Date`', 'columnPosition': 3672}, {'columnName': '`Updated Order Date`', 'columnPosition': 3728}, {'columnName': '`Updated Order Date`', 'columnPosition': 3765}, {'columnName': '`Total Sales`', 'columnPosition': 3816}, {'columnName': '`Updated Order Date`', 'columnPosition': 3945}, {'columnName': '`Updated Order Date`', 'columnPosition': 3994}, {'columnName': '`Updated Order Date`', 'columnPosition': 4031}, {'columnName': '`Total Sales`', 'columnPosition': 4082}, {'columnName': '`Updated Order Date`', 'columnPosition': 4348}, {'columnName': '`Updated Order Date`', 'columnPosition': 4404}, {'columnName': '`Updated Order Date`', 'columnPosition': 4440}, {'columnName': '`Total Sales`', 'columnPosition': 4490}, {'columnName': '`Updated Order Date`', 'columnPosition': 4615}, {'columnName': '`Updated Order Date`', 'columnPosition': 4666}, {'columnName': '`Updated Order Date`', 'columnPosition': 4702}, {'columnName': '`Total Sales`', 'columnPosition': 4752}], 'variable': False}, 'calculation_730b783f-42a1-443f-9162-73c1b8b88a56': {'templateId': 1376, 'id': 'calculation_730b783f-42a1-443f-9162-73c1b8b88a56', 'name': 'BM Dimension', 'formula': "(CASE \nWHEN DOMO_BEAST_MODE(1358) = 'Region' then `Region`\nWHEN DOMO_BEAST_MODE(1358) = 'State' then `State`\nWHEN DOMO_BEAST_MODE(1358) = 'City' THEN `City`\nWHEN DOMO_BEAST_MODE(1358) = 'Brand' THEN `Brand`\nWHEN DOMO_BEAST_MODE(1358) = 'Department' THEN `Product Category`\nWHEN DOMO_BEAST_MODE(1358) = 'Store' THEN `District`\nEND)\n-- Jason was here", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 50}, {'columnName': '`State`', 'columnPosition': 101}, {'columnName': '`City`', 'columnPosition': 150}, {'columnName': '`Brand`', 'columnPosition': 199}, {'columnName': '`Product Category`', 'columnPosition': 254}, {'columnName': '`District`', 'columnPosition': 315}], 'variable': False}, 'calculation_785f3b09-7b73-4c25-ab7d-2fd02c5ed778': {'templateId': 1374, 'id': 'calculation_785f3b09-7b73-4c25-ab7d-2fd02c5ed778', 'name': 'Mobile % pen to Ttl sls', 'formula': 'SUM(`Mobile Sls`) / SUM(`Total Sales`)', 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Mobile Sls`', 'columnPosition': 4}, {'columnName': '`Total Sales`', 'columnPosition': 24}], 'variable': False}, 'calculation_b3e2d90d-d676-4e55-9e27-1b77749414f9': {'templateId': 1386, 'id': 'calculation_b3e2d90d-d676-4e55-9e27-1b77749414f9', 'name': 'BM PoP dimension', 'formula': "(CASE \nWHEN DOMO_BEAST_MODE(1385) = 'Country' then `Country`\nWHEN DOMO_BEAST_MODE(1385) = 'Region' then `Region`\nWHEN DOMO_BEAST_MODE(1385) = 'State' then `State`\nWHEN DOMO_BEAST_MODE(1385) = 'City' THEN `City`\nWHEN DOMO_BEAST_MODE(1385) = 'Brand' THEN `Brand`\nWHEN DOMO_BEAST_MODE(1385) = 'Category' THEN `Product Category`\nWHEN DOMO_BEAST_MODE(1385) = 'Sub category' THEN `Product Sub-Category`\nWHEN DOMO_BEAST_MODE(1385) = 'Dept' THEN `Department`\nEND)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Country`', 'columnPosition': 51}, {'columnName': '`Region`', 'columnPosition': 104}, {'columnName': '`State`', 'columnPosition': 155}, {'columnName': '`City`', 'columnPosition': 204}, {'columnName': '`Brand`', 'columnPosition': 253}, {'columnName': '`Product Category`', 'columnPosition': 306}, {'columnName': '`Product Sub-Category`', 'columnPosition': 374}, {'columnName': '`Department`', 'columnPosition': 438}], 'variable': False}, 'calculation_27bd4760-fabb-4060-a6e0-aa77b5d26153': {'templateId': 1431, 'id': 'calculation_27bd4760-fabb-4060-a6e0-aa77b5d26153', 'name': 'BM Choose dimension 3', 'formula': "(CASE \n   WHEN DOMO_BEAST_MODE(1430) = 'Country' THEN `Country`\n   WHEN DOMO_BEAST_MODE(1430) = 'Region' THEN `Region`\n   WHEN DOMO_BEAST_MODE(1430) = 'State' THEN `State`\n   WHEN DOMO_BEAST_MODE(1430) = 'City' THEN `City`\n   WHEN DOMO_BEAST_MODE(1430) = 'Brand' THEN `Brand`\n   WHEN DOMO_BEAST_MODE(1430) = 'Category' THEN `Product Category`\n   WHEN DOMO_BEAST_MODE(1430) = 'Dept' THEN `Department`\nEND)", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Country`', 'columnPosition': 54}, {'columnName': '`Region`', 'columnPosition': 110}, {'columnName': '`State`', 'columnPosition': 164}, {'columnName': '`City`', 'columnPosition': 216}, {'columnName': '`Brand`', 'columnPosition': 268}, {'columnName': '`Product Category`', 'columnPosition': 324}, {'columnName': '`Department`', 'columnPosition': 387}], 'variable': False}, 'calculation_84241007-5c36-4f25-9907-43829f56adb4': {'templateId': 1436, 'id': 'calculation_84241007-5c36-4f25-9907-43829f56adb4', 'name': '% Diff (Level 2)', 'formula': "SUM(CASE     \n \tWHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n               WHEN (MONTH(CURDATE()) = MONTH(`Updated Order Date`)) AND (YEAR(CURDATE()) = YEAR(`Updated Order Date`)) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n               ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\n  \tWHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n  \t  (CASE\n          WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n            (CASE\n              WHEN YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n            (CASE\n              WHEN QUARTER(CURDATE()) = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n            (CASE\n              WHEN MONTH(CURDATE()) = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n          WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n            (CASE\n              WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n              ELSE 0\n            END)\n        END)\nEND)\n/\nSUM\t\t(CASE   \t\n           WHEN DOMO_BEAST_MODE(1428) = 'Yes' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) <= DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) <= DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) <= DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n            WHEN DOMO_BEAST_MODE(1428) = 'No' THEN\n              (CASE\n                  WHEN DOMO_BEAST_MODE(1366) = 'YTD' THEN\n                   (CASE\n                      WHEN YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFYEAR(`Updated Order Date`) < DAYOFYEAR(CURDATE()) THEN `Total Sales`\n                      ELSE 0\n                    END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'QTD' THEN\n                   (CASE \n                     WHEN QUARTER(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN QUARTER(`Updated Order Date`) = 4 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) + 9)) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN QUARTER(CURDATE())-1 = QUARTER(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND (MONTH(`Updated Order Date`) <= (MONTH(CURDATE()) - 3)) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'MTD' THEN\n                   (CASE \n                     WHEN MONTH(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN MONTH(`Updated Order Date`) = 12 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN MONTH(CURDATE())-1 = MONTH(`Updated Order Date`) AND YEAR(CURDATE()) = YEAR(`Updated Order Date`) AND DAYOFMONTH(`Updated Order Date`) < DAYOFMONTH(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                  WHEN DOMO_BEAST_MODE(1366) = 'WTD' THEN\n                   (CASE \n                     WHEN WEEK(CURDATE()) = 1 THEN\n                       (CASE\n                          WHEN WEEK(`Updated Order Date`) = 52 AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                          ELSE 0\n                        END)\n                     WHEN WEEK(CURDATE()) = WEEK(`Updated Order Date`) AND YEAR(CURDATE())-1 = YEAR(`Updated Order Date`) AND DAYOFWEEK(`Updated Order Date`) < DAYOFWEEK(CURDATE()) THEN `Total Sales`\n                     ELSE 0\n                   END)\n                END)\n       \t\tEND)\n-1", 'status': 'VALID', 'dataType': 'DOUBLE', 'persistedOnDataSource': True, 'isAggregatable': True, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 176}, {'columnName': '`Updated Order Date`', 'columnPosition': 212}, {'columnName': '`Total Sales`', 'columnPosition': 263}, {'columnName': '`Updated Order Date`', 'columnPosition': 431}, {'columnName': '`Updated Order Date`', 'columnPosition': 480}, {'columnName': '`Updated Order Date`', 'columnPosition': 516}, {'columnName': '`Total Sales`', 'columnPosition': 567}, {'columnName': '`Updated Order Date`', 'columnPosition': 733}, {'columnName': '`Updated Order Date`', 'columnPosition': 784}, {'columnName': '`Updated Order Date`', 'columnPosition': 821}, {'columnName': '`Total Sales`', 'columnPosition': 872}, {'columnName': '`Updated Order Date`', 'columnPosition': 1035}, {'columnName': '`Updated Order Date`', 'columnPosition': 1084}, {'columnName': '`Updated Order Date`', 'columnPosition': 1120}, {'columnName': '`Total Sales`', 'columnPosition': 1171}, {'columnName': '`Updated Order Date`', 'columnPosition': 1399}, {'columnName': '`Updated Order Date`', 'columnPosition': 1435}, {'columnName': '`Total Sales`', 'columnPosition': 1485}, {'columnName': '`Updated Order Date`', 'columnPosition': 1653}, {'columnName': '`Updated Order Date`', 'columnPosition': 1702}, {'columnName': '`Updated Order Date`', 'columnPosition': 1738}, {'columnName': '`Total Sales`', 'columnPosition': 1788}, {'columnName': '`Updated Order Date`', 'columnPosition': 1952}, {'columnName': '`Updated Order Date`', 'columnPosition': 2001}, {'columnName': '`Updated Order Date`', 'columnPosition': 2037}, {'columnName': '`Total Sales`', 'columnPosition': 2087}, {'columnName': '`Updated Order Date`', 'columnPosition': 2249}, {'columnName': '`Updated Order Date`', 'columnPosition': 2298}, {'columnName': '`Updated Order Date`', 'columnPosition': 2334}, {'columnName': '`Total Sales`', 'columnPosition': 2384}, {'columnName': '`Updated Order Date`', 'columnPosition': 2677}, {'columnName': '`Updated Order Date`', 'columnPosition': 2713}, {'columnName': '`Total Sales`', 'columnPosition': 2764}, {'columnName': '`Updated Order Date`', 'columnPosition': 3038}, {'columnName': '`Updated Order Date`', 'columnPosition': 3093}, {'columnName': '`Updated Order Date`', 'columnPosition': 3126}, {'columnName': '`Total Sales`', 'columnPosition': 3180}, {'columnName': '`Updated Order Date`', 'columnPosition': 3313}, {'columnName': '`Updated Order Date`', 'columnPosition': 3362}, {'columnName': '`Updated Order Date`', 'columnPosition': 3395}, {'columnName': '`Total Sales`', 'columnPosition': 3449}, {'columnName': '`Updated Order Date`', 'columnPosition': 3717}, {'columnName': '`Updated Order Date`', 'columnPosition': 3773}, {'columnName': '`Updated Order Date`', 'columnPosition': 3810}, {'columnName': '`Total Sales`', 'columnPosition': 3862}, {'columnName': '`Updated Order Date`', 'columnPosition': 3991}, {'columnName': '`Updated Order Date`', 'columnPosition': 4040}, {'columnName': '`Updated Order Date`', 'columnPosition': 4077}, {'columnName': '`Total Sales`', 'columnPosition': 4129}, {'columnName': '`Updated Order Date`', 'columnPosition': 4395}, {'columnName': '`Updated Order Date`', 'columnPosition': 4451}, {'columnName': '`Updated Order Date`', 'columnPosition': 4487}, {'columnName': '`Total Sales`', 'columnPosition': 4538}, {'columnName': '`Updated Order Date`', 'columnPosition': 4663}, {'columnName': '`Updated Order Date`', 'columnPosition': 4714}, {'columnName': '`Updated Order Date`', 'columnPosition': 4750}, {'columnName': '`Total Sales`', 'columnPosition': 4801}, {'columnName': '`Updated Order Date`', 'columnPosition': 5094}, {'columnName': '`Updated Order Date`', 'columnPosition': 5130}, {'columnName': '`Total Sales`', 'columnPosition': 5180}, {'columnName': '`Updated Order Date`', 'columnPosition': 5454}, {'columnName': '`Updated Order Date`', 'columnPosition': 5509}, {'columnName': '`Updated Order Date`', 'columnPosition': 5542}, {'columnName': '`Total Sales`', 'columnPosition': 5596}, {'columnName': '`Updated Order Date`', 'columnPosition': 5729}, {'columnName': '`Updated Order Date`', 'columnPosition': 5778}, {'columnName': '`Updated Order Date`', 'columnPosition': 5811}, {'columnName': '`Total Sales`', 'columnPosition': 5865}, {'columnName': '`Updated Order Date`', 'columnPosition': 6133}, {'columnName': '`Updated Order Date`', 'columnPosition': 6189}, {'columnName': '`Updated Order Date`', 'columnPosition': 6226}, {'columnName': '`Total Sales`', 'columnPosition': 6277}, {'columnName': '`Updated Order Date`', 'columnPosition': 6406}, {'columnName': '`Updated Order Date`', 'columnPosition': 6455}, {'columnName': '`Updated Order Date`', 'columnPosition': 6492}, {'columnName': '`Total Sales`', 'columnPosition': 6543}, {'columnName': '`Updated Order Date`', 'columnPosition': 6809}, {'columnName': '`Updated Order Date`', 'columnPosition': 6865}, {'columnName': '`Updated Order Date`', 'columnPosition': 6901}, {'columnName': '`Total Sales`', 'columnPosition': 6951}, {'columnName': '`Updated Order Date`', 'columnPosition': 7076}, {'columnName': '`Updated Order Date`', 'columnPosition': 7127}, {'columnName': '`Updated Order Date`', 'columnPosition': 7163}, {'columnName': '`Total Sales`', 'columnPosition': 7213}], 'variable': False}, 'calculation_890ca23c-d750-41ea-ae65-d231a3fa4f55': {'templateId': 1442, 'id': 'calculation_890ca23c-d750-41ea-ae65-d231a3fa4f55', 'name': 'Week of Year', 'formula': 'WEEKOFYEAR(`Updated Order Date`)', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Updated Order Date`', 'columnPosition': 11}], 'variable': False}, 'calculation_992755c8-6212-40e1-a9ed-862533e76d70': {'templateId': 1412, 'id': 'calculation_992755c8-6212-40e1-a9ed-862533e76d70', 'name': 'pr-beast mode', 'formula': "CASE WHEN DOMO_BEAST_MODE(1411) = 'Region' THEN `Region` WHEN DOMO_BEAST_MODE(1411) = 'Brand' THEN `Brand` END", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 48}, {'columnName': '`Brand`', 'columnPosition': 99}], 'variable': False}, 'calculation_3c353edd-9ef6-46b1-a0be-ba04681722ac': {'templateId': 1414, 'id': 'calculation_3c353edd-9ef6-46b1-a0be-ba04681722ac', 'name': 'Test BM', 'formula': 'DOMO_BEAST_MODE(1413)', 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'variable': False}, 'calculation_a391a1a5-c0b5-43bd-8ee0-9d5b8478ff14': {'templateId': 1421, 'id': 'calculation_a391a1a5-c0b5-43bd-8ee0-9d5b8478ff14', 'name': 'Table Switch Group 1', 'formula': "CASE \nWHEN DOMO_BEAST_MODE(1419) = 'Region' then `Region`\nWHEN DOMO_BEAST_MODE(1419)= 'State' then `State`\nWHEN DOMO_BEAST_MODE(1419)= 'City' THEN `City`\nWHEN DOMO_BEAST_MODE(1419)= 'Brand' THEN `Brand`\nWHEN DOMO_BEAST_MODE(1419)= 'Category' THEN `Product Category`\nWHEN DOMO_BEAST_MODE(1419) = 'Department' THEN `Department`\nEND", 'status': 'VALID', 'dataType': 'STRING', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'columnPositions': [{'columnName': '`Region`', 'columnPosition': 49}, {'columnName': '`State`', 'columnPosition': 99}, {'columnName': '`City`', 'columnPosition': 147}, {'columnName': '`Brand`', 'columnPosition': 195}, {'columnName': '`Product Category`', 'columnPosition': 247}, {'columnName': '`Department`', 'columnPosition': 313}], 'variable': False}, 'calculation_a43f4919-3352-4bab-ba1c-ba5a502849b2': {'templateId': 1371, 'id': 'calculation_a43f4919-3352-4bab-ba1c-ba5a502849b2', 'name': 'BM Goal for 2022', 'formula': 'DOMO_BEAST_MODE(1359)', 'status': 'VALID', 'dataType': 'LONG', 'persistedOnDataSource': True, 'isAggregatable': False, 'bignumber': False, 'variable': False}}, Schema=DomoDataset_Schema(dataset_id='ea859b06-5dbe-4c31-be76-de921447d550', columns=[]), Stream=DomoStream(id=699, dataset_id='ea859b06-5dbe-4c31-be76-de921447d550', transport_description=None, transport_version=None, update_method=None, data_provider_name=None, data_provider_key=None, account_id=None, account_display_name=None, account_userid=None, has_mapping=False, configuration=[], configuration_tables=[], configuration_query=None), Tags=DomoTags(tag_ls=['Oct-28-2024 17:06', 'developer_documentation', 'hackercore']), PDP=<domolibrary.classes.DomoPDP.Dataset_PDP_Policies object>, Certification=None),
 DomoDataset(id='6bbff3ee-351c-467b-bf9b-d121af70dfb8', display_type='webform', data_provider_type='webform', name='LesMisNodes', description=None, row_count=77, column_count=2, stream_id=1041, owner={'id': '1893952720', 'name': 'Jae Wilson1', 'type': 'USER', 'group': False}, formula={}, Schema=DomoDataset_Schema(dataset_id='6bbff3ee-351c-467b-bf9b-d121af70dfb8', columns=[]), Stream=DomoStream(id=1041, dataset_id='6bbff3ee-351c-467b-bf9b-d121af70dfb8', transport_description=None, transport_version=None, update_method=None, data_provider_name=None, data_provider_key=None, account_id=None, account_display_name=None, account_userid=None, has_mapping=False, configuration=[], configuration_tables=[], configuration_query=None), Tags=DomoTags(tag_ls=[]), PDP=<domolibrary.classes.DomoPDP.Dataset_PDP_Policies object>, Certification=None)]
import domolibrary.classes.DomoDataset as dmd


def process_ds(
    domo_dataset: dmd.DomoDataset,
) -> dict:  # dictionary where each attribute except _id and _ds_name becomes a tag
    """
    receives DomoDataset object, and then generates an object with attributes that will become tags.
    every organization will have different naming conventions and therefore must generate different rules for how tags can be exctracted from the Domo Dataset object.
    """

    proj_str = domo_dataset.name.split("_", 1)[0]
    proj_name = proj_str[:-2]
    proj_phase = proj_str[-2:]

    _ = domo_dataset.name.split("_", 1)[1]

    ds_type = _.split("_")[-1].replace(" *", "")

    return {
        "_id": domo_dataset.id,
        "_ds_name": domo_dataset.name,
        "provider_type": domo_dataset.display_type or domo_dataset.data_provider_type,
        "proj_name": proj_name,
        "proj_phase": proj_phase,
        "ds_type": ds_type,
    }
import pandas as pd

# for this project we assume any dataset that ends with * has been validated as adhering to the naming convention format.
dataset_tags_to_update = [
    process_ds(domo_dataset)
    for domo_dataset in domo_datasets
    if domo_dataset.name.endswith("*")
]

pd.DataFrame(dataset_tags_to_update)
_id _ds_name provider_type proj_name proj_phase ds_type
0 da552832-c04d-46ac-936a-f982d9d3f2e6 SalesProject01_hello world_INT * api SalesProject 01 INT
1 063dd227-2a2d-4563-a372-6d08c950e86d SalesProject02_summary_by_month_DASH * api SalesProject 02 DASH
2 6114155e-e6a5-4c9c-bec0-5f0b8e807579 SalesProject01_hello world3_INT * api SalesProject 01 INT
3 e5f44d26-4028-4282-88a9-239a0f909373 SalesProject02_summary_by_day_DASH * api SalesProject 02 DASH
def generate_tags(tag_dict):
    """
    simple utility function to collapse key/value pairs into a string
    tags generated by this process will be suffixed with an *
    """

    tag_ls = [
        f"{key} : {tag_dict[key]} *"
        for key in tag_dict.keys()
        if not key.startswith("_")
    ]

    info = {
        key.replace("_", ""): tag_dict[key]
        for key in tag_dict.keys()
        if key.startswith("_")
    }

    return {"tag_ls": tag_ls, **info}
from pprint import pprint

# for each dataset to update, tag_ls contains the list of tags that will be added.
dataset_tags_for_api = [generate_tags(tag_dict) for tag_dict in dataset_tags_to_update]

pprint(dataset_tags_for_api)
[{'dsname': 'SalesProject01_hello world_INT *',
  'id': 'da552832-c04d-46ac-936a-f982d9d3f2e6',
  'tag_ls': ['provider_type : api *',
             'proj_name : SalesProject *',
             'proj_phase : 01 *',
             'ds_type : INT *']},
 {'dsname': 'SalesProject02_summary_by_month_DASH *',
  'id': '063dd227-2a2d-4563-a372-6d08c950e86d',
  'tag_ls': ['provider_type : api *',
             'proj_name : SalesProject *',
             'proj_phase : 02 *',
             'ds_type : DASH *']},
 {'dsname': 'SalesProject01_hello world3_INT *',
  'id': '6114155e-e6a5-4c9c-bec0-5f0b8e807579',
  'tag_ls': ['provider_type : api *',
             'proj_name : SalesProject *',
             'proj_phase : 01 *',
             'ds_type : INT *']},
 {'dsname': 'SalesProject02_summary_by_day_DASH *',
  'id': 'e5f44d26-4028-4282-88a9-239a0f909373',
  'tag_ls': ['provider_type : api *',
             'proj_name : SalesProject *',
             'proj_phase : 02 *',
             'ds_type : DASH *']}]
import asyncio
from typing import List

import domolibrary.classes.DomoDataset as dmd


async def process_dataset_tags(dataset_id, tag_ls: List[str], auth: dmda.DomoAuth):
    """
    function to actually update domo dataset entities.
    tags previously added by this process (denoted with the * suffix) will be removed
    """

    domo_dataset = await dmd.DomoDataset.get_by_id(dataset_id=dataset_id, auth=auth)
    
    await domo_dataset.Tags.get()

    # remove old tags
    remove_tag_ls = [tag for tag in domo_dataset.Tags.tag_ls if tag.endswith(" *")]

    if len(remove_tag_ls) > 0:
        await domo_dataset.Tags.remove(remove_tag_ls=remove_tag_ls)

    # add new tags
    await domo_dataset.Tags.add(add_tag_ls=tag_ls)

    return {
        "id": domo_dataset.id,
        "name": domo_dataset.name,
        "tags": domo_dataset.Tags.tag_ls,
    }
import pandas as pd

res = await asyncio.gather(
    *[
        process_dataset_tags(
            dataset_id=row.get("id"), tag_ls=row.get("tag_ls"), auth=token_auth
        )
        for row in dataset_tags_for_api
    ]
)

pd.DataFrame(res)
id name tags
0 da552832-c04d-46ac-936a-f982d9d3f2e6 SalesProject01_hello world_INT * [provider_type : api *, proj_phase : 01 *, pro...
1 063dd227-2a2d-4563-a372-6d08c950e86d SalesProject02_summary_by_month_DASH * [provider_type : api *, proj_phase : 02 *, pro...
2 6114155e-e6a5-4c9c-bec0-5f0b8e807579 SalesProject01_hello world3_INT * [provider_type : api *, proj_phase : 01 *, pro...
3 e5f44d26-4028-4282-88a9-239a0f909373 SalesProject02_summary_by_day_DASH * [provider_type : api *, proj_phase : 02 *, pro...