diff --git a/LookML_Dashboard/balance_sheet_finance_table.dashboard.lookml b/LookML_Dashboard/balance_sheet_mktplace_report_table.dashboard.lookml
similarity index 60%
rename from LookML_Dashboard/balance_sheet_finance_table.dashboard.lookml
rename to LookML_Dashboard/balance_sheet_mktplace_report_table.dashboard.lookml
index f67c1d33..70028324 100644
--- a/LookML_Dashboard/balance_sheet_finance_table.dashboard.lookml
+++ b/LookML_Dashboard/balance_sheet_mktplace_report_table.dashboard.lookml
@@ -1,11 +1,11 @@
# This dashboard requires the Report Table visualization (available for free on Looker Marketplace) to be installed.
-- dashboard: balance_sheet_finance_table
- title: Balance Sheet Finance Report
+- dashboard: balance_sheet_mktplace_report_table
+ title: Financial Statement - Balance Sheet
layout: newspaper
preferred_viewer: dashboards-next
filters_location_top: false
- description: "Reports Fiscal Period Cumulative Amount in Global Currency for Levels 2, 3, and 4 of the selected hierarchy, chart of accounts, company, fiscal period and comparison period (if any). Requires Report Table visualization to be downloaded from Looker Marketplace."
+ description: "Reports Fiscal Period Cumulative Amount in Global Currency for Levels 3 and 4 of the selected hierarchy, chart of accounts, company, fiscal period and comparison period (if any). Requires Report Table visualization to be downloaded from Looker Marketplace."
elements:
- title: Summary Title
@@ -19,11 +19,12 @@
show_single_value_title: false
show_comparison: false
listen:
- Global Currency: balance_sheet.target_currency_tcurr
+ Currency: balance_sheet.target_currency_tcurr
Chart of Accounts: balance_sheet.chart_of_accounts
Company: balance_sheet.company_text
Fiscal Period: balance_sheet.select_fiscal_period
Hierarchy: balance_sheet.hierarchy_name
+ Ledger: balance_sheet.ledger_name
row: 0
col: 0
width: 18
@@ -33,27 +34,25 @@
name: Balance Sheet
explore: balance_sheet
type: marketplace_viz_report_table::report_table-marketplace
- fields: [balance_sheet.level_number,balance_sheet.parent, balance_sheet.parent_text, balance_sheet.node,
- balance_sheet.node_text, balance_sheet.total_cumulative_amount_in_global_currency, balance_sheet.fiscal_year_period]
+ fields: [balance_sheet_hierarchy_selection_sdt.hier1_node_text, balance_sheet_hierarchy_selection_sdt.hier2_node_text,
+ balance_sheet.total_cumulative_amount_in_global_currency, balance_sheet.fiscal_year_period,
+ balance_sheet_hierarchy_selection_sdt.hier3_node_text]
pivots: [balance_sheet.fiscal_year_period]
- filters:
- balance_sheet.level_number: '2,3,4'
- sorts: [balance_sheet.fiscal_year_period, balance_sheet.level_number, balance_sheet.parent,balance_sheet.node]
- limit: 5000
+ filters: {}
+ sorts: [balance_sheet.fiscal_year_period desc, balance_sheet_hierarchy_selection_sdt.hier1_node_text,
+ balance_sheet_hierarchy_selection_sdt.hier2_node_text, balance_sheet_hierarchy_selection_sdt.hier3_node_text]
total: true
- hidden_fields: [balance_sheet.level_number, balance_sheet.parent, balance_sheet.node]
- hidden_points_if_no: []
series_labels: {}
show_view_names: false
theme: contemporary
- # customTheme: ''
+ customTheme: ''
layout: auto
minWidthForIndexColumns: true
headerFontSize: 12
bodyFontSize: 12
showTooltip: true
showHighlight: true
- # columnOrder: {}
+ columnOrder: {}
rowSubtotals: true
colSubtotals: false
spanRows: true
@@ -68,57 +67,40 @@
genericLabelForSubtotals: false
indexColumn: false
transposeTable: false
- label|balance_sheet.parent_text: Parent
- heading|balance_sheet.parent_text: ''
- hide|balance_sheet.parent_text: false
- label|balance_sheet.node_text: Node
- heading|balance_sheet.node_text: ''
- hide|balance_sheet.node_text: false
+ label|balance_sheet_hierarchy_selection_sdt.hier1_node_text: " "
+ label|balance_sheet_hierarchy_selection_sdt.hier2_node_text: " "
+ label|balance_sheet_hierarchy_selection_sdt.hier3_node_text: " "
subtotalDepth: '1'
label|balance_sheet.total_cumulative_amount_in_global_currency: Amount
- heading|balance_sheet.total_cumulative_amount_in_global_currency: ''
style|balance_sheet.total_cumulative_amount_in_global_currency: black_red
reportIn|balance_sheet.total_cumulative_amount_in_global_currency: '1'
- unit|balance_sheet.total_cumulative_amount_in_global_currency: ''
comparison|balance_sheet.total_cumulative_amount_in_global_currency: balance_sheet.fiscal_year_period
switch|balance_sheet.total_cumulative_amount_in_global_currency: false
var_num|balance_sheet.total_cumulative_amount_in_global_currency: true
var_pct|balance_sheet.total_cumulative_amount_in_global_currency: true
- show_row_numbers: false
- transpose: false
+ title_hidden: true
truncate_text: true
hide_totals: false
hide_row_totals: false
size_to_fit: true
- table_theme: white
- limit_displayed_rows: false
- enable_conditional_formatting: false
header_text_alignment: left
header_font_size: '12'
rows_font_size: '12'
- conditional_formatting_include_totals: false
- conditional_formatting_include_nulls: false
- show_sql_query_menu_options: false
show_totals: true
show_row_totals: true
truncate_header: false
minimum_column_width: 75
- series_cell_visualizations:
- balance_sheet.total_cumulative_amount_in_global_currency:
- is_active: false
- hidden_pivots: {}
- defaults_version: 0
- y_axes: []
- title_hidden: true
+
listen:
Fiscal Period: balance_sheet.select_fiscal_period
Comparison Type: balance_sheet.select_comparison_type
- Custom Comparison (Optional): balance_sheet.select_custom_comparison_period
+ Custom Comparison Period: balance_sheet.select_custom_comparison_period
Hierarchy: balance_sheet.hierarchy_name
Chart of Accounts: balance_sheet.chart_of_accounts
Company: balance_sheet.company_text
- Global Currency: balance_sheet.target_currency_tcurr
-
+ Currency: balance_sheet.target_currency_tcurr
+ Ledger: balance_sheet.ledger_name
+ Top Hierarchy Level to Display: balance_sheet_hierarchy_selection_sdt.parameter_pick_start_level
row: 2
col: 0
width: 18
@@ -130,9 +112,8 @@
- name: Fiscal Period
title: Fiscal Period
type: field_filter
- # default_value: '2023.11'
- # assumes as 12 month fiscal period that aligns with calendar. Will find last month and select period with same value
- default_value: "{% assign current_month = \"today\" | date: '%m' %}{% assign current_year = \"today\" | date: '%Y' %}{% if current_month == '01' %}{% assign last_month = '12' %}{% assign last_month_year = current_year | times: 1 | minus: 1 %}{% else %}{% assign last_month = current_month | times: 1 | minus: 1 | prepend: '00' | slice: -2, 2 %}{% assign last_month_year = current_year %}{% endif %}{% assign last_period = last_month_year | append: '.' | append: last_month %}{{last_period | strip}}"
+ # assumes as 12 month fiscal period that aligns with calendar. Will find last complete month and select period with same value
+ default_value: "{% if _user_attributes['sap_use_demo_data']=='Yes'%}{% assign ym = '2023.011'%}{%else%}{% assign intervalDays = 31 %}{% assign intervalSeconds = intervalDays | times: 86400 %}{% assign daysMinus31 = 'now' | date: '%s' | minus: intervalSeconds %}{% assign m = daysMinus31 | date: '%m' | prepend: '00' | slice: -3,3 %}{% assign ym = daysMinus31 | date: '%Y' | append: '.' | append: m %}{%endif%}{{ym}}"
allow_multiple_values: false
required: true
ui_config:
@@ -153,8 +134,8 @@
explore: balance_sheet
field: balance_sheet.select_comparison_type
- - name: Custom Comparison (Optional)
- title: Custom Comparison (Optional)
+ - name: Custom Comparison Period
+ title: Custom Comparison Period
type: field_filter
default_value: ''
allow_multiple_values: false
@@ -165,11 +146,10 @@
explore: balance_sheet
field: balance_sheet.select_custom_comparison_period
- - name: Global Currency
- title: Global Currency
+ - name: Currency
+ title: Currency
type: field_filter
default_value: USD
- # default_value: "{% assign dc = _user_attributes['sap_default_global_currency %}{{dc}}"
allow_multiple_values: false
required: true
ui_config:
@@ -182,7 +162,6 @@
title: Hierarchy
type: field_filter
default_value: FPA1
- # default_value: "{% assign dh = _user_attributes['sap_balance_sheet_default_hierarchy']%}{{dh}}"
allow_multiple_values: false
required: true
ui_config:
@@ -194,8 +173,7 @@
- name: Chart of Accounts
title: Chart of Accounts
type: field_filter
- default_value: CA01
- # default_value: "{% assign dca = _user_attributes['sap_balance_sheet_default_chart_of_accounts']%}{{dca}}"
+ default_value: "{% if _user_attributes['sap_sql_flavor']=='S4' %}{% assign coa = 'YCOA'%}{%else%}{% assign coa = 'CA01' %}{% endif %}{{coa}}"
allow_multiple_values: false
required: true
ui_config:
@@ -208,7 +186,6 @@
title: Company
type: field_filter
default_value: "%CENTRAL%"
- # default_value: "{% assign dco = _user_attributes['sap_balance_sheet_default_company']%}{{dco}}"
allow_multiple_values: false
required: true
ui_config:
@@ -216,3 +193,28 @@
display: popover
explore: balance_sheet
field: balance_sheet.company_text
+
+ - name: Ledger
+ title: Ledger
+ type: field_filter
+ default_value: "0L - Leading Ledger"
+ allow_multiple_values: true
+ required: false
+ ui_config:
+ type: tag_list
+ display: inline
+ explore: balance_sheet
+ field: balance_sheet.ledger_name
+
+ - name: Top Hierarchy Level to Display
+ title: Top Hierarchy Level to Display
+ type: field_filter
+ default_value: '2'
+ allow_multiple_values: false
+ required: false
+ ui_config:
+ type: dropdown_menu
+ display: inline
+ explore: balance_sheet
+ listens_to_filters: []
+ field: balance_sheet_hierarchy_selection_sdt.parameter_pick_start_level
diff --git a/LookML_Dashboard/balance_sheet_subtotal_table.dashboard.lookml b/LookML_Dashboard/balance_sheet_subtotal_table.dashboard.lookml
index 2265e56b..534c3e11 100644
--- a/LookML_Dashboard/balance_sheet_subtotal_table.dashboard.lookml
+++ b/LookML_Dashboard/balance_sheet_subtotal_table.dashboard.lookml
@@ -1,9 +1,11 @@
-- dashboard: balance_sheet_subtotal_table
- title: Balance Sheet Subtotals Report
+- dashboard: balance_sheet_subtotal3_table
+ title: Financial Statement - Balance Sheet
layout: newspaper
preferred_viewer: dashboards-next
+ description: Using standard table with subtotals, reports Fiscal Period Cumulative
+ Amount in Global Currency for the selected hierarchy, chart
+ of accounts, company, fiscal period and comparison period (if any).
filters_location_top: false
- description: "Using standard table with subtotals, reports Fiscal Period Cumulative Amount in Global Currency for Levels 2, 3, and 4 of the selected hierarchy, chart of accounts, company, fiscal period and comparison period (if any)."
elements:
- title: Summary Title
@@ -17,29 +19,27 @@
show_single_value_title: false
show_comparison: false
listen:
- Global Currency: balance_sheet.target_currency_tcurr
+ Currency: balance_sheet.target_currency_tcurr
Chart of Accounts: balance_sheet.chart_of_accounts
Company: balance_sheet.company_text
Fiscal Period: balance_sheet.select_fiscal_period
Hierarchy: balance_sheet.hierarchy_name
+ Ledger: balance_sheet.ledger_name
row: 0
col: 0
- width: 22
- height: 2
+ width: 24
+ height: 3
- title: Balance Sheet
name: Balance Sheet
explore: balance_sheet
type: looker_grid
- fields: [balance_sheet.parent_text, balance_sheet.node_text,balance_sheet.comparison_period_amount_in_global_currency, balance_sheet.reporting_period_amount_in_global_currency,
- balance_sheet.difference_value,balance_sheet.difference_percent]
- filters:
- balance_sheet.level_number: '2,3,4'
- sorts: [balance_sheet.parent_text, balance_sheet.reporting_period_amount_in_global_currency
- desc]
- subtotals: [balance_sheet.parent_text]
- limit: 500
- column_limit: 50
+ fields: [balance_sheet.reporting_period_amount_in_global_currency, balance_sheet.comparison_period_amount_in_global_currency,
+ balance_sheet.difference_value, balance_sheet.difference_percent, balance_sheet_hierarchy_selection_sdt.hier1_node_text,
+ balance_sheet_hierarchy_selection_sdt.hier2_node_text, balance_sheet_hierarchy_selection_sdt.hier3_node_text]
+ sorts: [balance_sheet_hierarchy_selection_sdt.hier1_node_text, balance_sheet_hierarchy_selection_sdt.hier2_node_text, balance_sheet_hierarchy_selection_sdt.hier3_node_text]
+ subtotals: [balance_sheet_hierarchy_selection_sdt.hier1_node_text, balance_sheet_hierarchy_selection_sdt.hier2_node_text]
+
total: true
show_view_names: false
show_row_numbers: true
@@ -60,68 +60,46 @@
show_totals: true
show_row_totals: true
truncate_header: false
+ title_hidden: true
minimum_column_width: 100
series_labels:
- balance_sheet.parent_text: Parent
- balance_sheet.node_text: Node
- series_column_widths:
- balance_sheet.node_text: 200
+ balance_sheet_hierarchy_selection_sdt.hier1_node_text: ' '
+ balance_sheet_hierarchy_selection_sdt.hier2_node_text: ' '
+ balance_sheet_hierarchy_selection_sdt.hier3_node_text: ' '
+ series_collapsed:
+ balance_sheet_hierarchy_selection_sdt.hier1_node_text: false
+ balance_sheet_hierarchy_selection_sdt.hier2_node_text: false
align: left
- x_axis_gridlines: false
- y_axis_gridlines: true
- show_y_axis_labels: true
- show_y_axis_ticks: true
- y_axis_tick_density: default
- y_axis_tick_density_custom: 5
- show_x_axis_label: true
- show_x_axis_ticks: true
- y_axis_scale_mode: linear
- x_axis_reversed: false
- y_axis_reversed: false
- plot_size_by_field: false
- trellis: ''
- stacking: ''
- legend_position: center
- point_style: none
- show_value_labels: false
- label_density: 25
- x_axis_scale: auto
- y_axis_combined: true
- ordering: none
- show_null_labels: false
- show_totals_labels: false
- show_silhouette: false
- totals_color: "#808080"
- defaults_version: 1
+
+ # defaults_version: 1
listen:
Fiscal Period: balance_sheet.select_fiscal_period
Comparison Type: balance_sheet.select_comparison_type
- Custom Comparison (Optional): balance_sheet.select_custom_comparison_period
+ Custom Comparison Period: balance_sheet.select_custom_comparison_period
Hierarchy: balance_sheet.hierarchy_name
Chart of Accounts: balance_sheet.chart_of_accounts
Company: balance_sheet.company_text
- Global Currency: balance_sheet.target_currency_tcurr
-
- row: 2
+ Currency: balance_sheet.target_currency_tcurr
+ Ledger: balance_sheet.ledger_name
+ Top Hierarchy Level: balance_sheet_hierarchy_selection_sdt.parameter_pick_start_level
+ row: 3
col: 0
- width: 22
+ width: 24
height: 13
-
-
filters:
- name: Fiscal Period
title: Fiscal Period
type: field_filter
- # default_value: '2023.11'
- # assumes as 12 month fiscal period that aligns with calendar. Will find last month and select period with same value
- default_value: "{% assign current_month = \"today\" | date: '%m' %}{% assign current_year = \"today\" | date: '%Y' %}{% if current_month == '01' %}{% assign last_month = '12' %}{% assign last_month_year = current_year | times: 1 | minus: 1 %}{% else %}{% assign last_month = current_month | times: 1 | minus: 1 | prepend: '00' | slice: -2, 2 %}{% assign last_month_year = current_year %}{% endif %}{% assign last_period = last_month_year | append: '.' | append: last_month %}{{last_period | strip}}"
+ # default assumes as 12 month fiscal period that aligns with calendar. Will find last complete month and select period with same value
+ default_value: "{% if _user_attributes['sap_use_demo_data']=='Yes'%}{% assign ym = '2023.011'%}{%else%}{% assign intervalDays = 31 %}{% assign intervalSeconds = intervalDays | times: 86400 %}{% assign daysMinus31 = 'now' | date: '%s' | minus: intervalSeconds %}{% assign m = daysMinus31 | date: '%m' | prepend: '00' | slice: -3,3 %}{% assign ym = daysMinus31 | date: '%Y' | append: '.' | append: m %}{%endif%}{{ym}}"
allow_multiple_values: false
required: true
ui_config:
type: dropdown_menu
display: inline
explore: balance_sheet
+ listens_to_filters: []
field: balance_sheet.select_fiscal_period
- name: Comparison Type
@@ -134,10 +112,11 @@
type: dropdown_menu
display: inline
explore: balance_sheet
+ listens_to_filters: []
field: balance_sheet.select_comparison_type
- - name: Custom Comparison (Optional)
- title: Custom Comparison (Optional)
+ - name: Custom Comparison Period
+ title: Custom Comparison Period
type: field_filter
default_value: ''
allow_multiple_values: false
@@ -146,56 +125,84 @@
type: dropdown_menu
display: inline
explore: balance_sheet
+ listens_to_filters: []
field: balance_sheet.select_custom_comparison_period
- - name: Global Currency
- title: Global Currency
+ - name: Currency
+ title: Currency
type: field_filter
default_value: USD
- # default_value: "{% assign dc = _user_attributes['sap_default_global_currency %}{{dc}}"
allow_multiple_values: false
required: true
ui_config:
type: dropdown_menu
display: inline
explore: balance_sheet
+ listens_to_filters: []
field: balance_sheet.target_currency_tcurr
- name: Hierarchy
title: Hierarchy
type: field_filter
default_value: FPA1
- # default_value: "{% assign dh = _user_attributes['sap_balance_sheet_default_hierarchy']%}{{dh}}"
allow_multiple_values: false
required: true
ui_config:
type: dropdown_menu
display: inline
explore: balance_sheet
+ listens_to_filters: []
field: balance_sheet.hierarchy_name
- name: Chart of Accounts
title: Chart of Accounts
type: field_filter
- default_value: CA01
- # default_value: "{% assign dca = _user_attributes['sap_balance_sheet_default_chart_of_accounts']%}{{dca}}"
+ # default_value: YCOA
+ default_value: "{% if _user_attributes['sap_sql_flavor']=='S4' %}{% assign coa = 'YCOA'%}{%else%}{% assign coa = 'CA01' %}{% endif %}{{coa}}"
allow_multiple_values: false
required: true
ui_config:
type: dropdown_menu
display: inline
explore: balance_sheet
+ listens_to_filters: []
field: balance_sheet.chart_of_accounts
- name: Company
title: Company
type: field_filter
default_value: "%CENTRAL%"
- # default_value: "{% assign dco = _user_attributes['sap_balance_sheet_default_company']%}{{dco}}"
allow_multiple_values: false
required: true
ui_config:
type: advanced
display: popover
explore: balance_sheet
+ listens_to_filters: []
field: balance_sheet.company_text
+
+ - name: Ledger
+ title: Ledger
+ type: field_filter
+ default_value: "0L - Leading Ledger"
+ allow_multiple_values: true
+ required: false
+ ui_config:
+ type: tag_list
+ display: popover
+ explore: balance_sheet
+ listens_to_filters: []
+ field: balance_sheet.ledger_name
+
+ - name: Top Hierarchy Level
+ title: Top Hierarchy Level
+ type: field_filter
+ default_value: '2'
+ allow_multiple_values: false
+ required: false
+ ui_config:
+ type: dropdown_menu
+ display: inline
+ explore: balance_sheet
+ listens_to_filters: []
+ field: balance_sheet_hierarchy_selection_sdt.parameter_pick_start_level
diff --git a/README.md b/README.md
index e641132c..1cb9d114 100644
--- a/README.md
+++ b/README.md
@@ -37,10 +37,10 @@ Gain faster insights into your Order to Cash, Finance, and Inventory data with t
> ⚠️ available beginning with [Google Cloud Cortex Framework 5.3](https://github.com/GoogleCloudPlatform/cortex-data-foundation).
-View the balance sheet as of a selected fiscal period, compared to the same period last year, the previous fiscal period, or a different fiscal period. And display the parent and child nodes for levels 2-4 of a selected hierarchy for a user-specified chart of accounts and company. Two dashboards using different table styles are included.
+View the balance sheet as of a selected fiscal period, compared to the same period last year, the previous fiscal period, or a different fiscal period. And display 3-levels of the selected hierarchy for a user-specified chart of accounts and company. Two dashboards using different table styles are included.
-- **Balance Sheet Finance Report** - This report uses an easy-to-read table style designed for finance reports. To use this dashboard, a Looker Admin must install the [Report Table](https://marketplace.looker.com/marketplace/detail/viz-report_table) plug-in/visualization type from Looker Marketplace. Refer to Looker documentation for [Using Looker Marketplace](https://cloud.google.com/looker/docs/marketplace).
+- **Balance Sheet Marketplace Report** - This report uses an easy-to-read table style designed for finance reports. To use this dashboard, a Looker Admin must install the [Report Table](https://marketplace.looker.com/marketplace/detail/viz-report_table) plug-in/visualization type from Looker Marketplace. Refer to Looker documentation for [Using Looker Marketplace](https://cloud.google.com/looker/docs/marketplace).
- **Balance Sheet Subtotals Report** - This report uses Looker's built-in table visualization with subtotals (no special installation required).
@@ -70,7 +70,7 @@ With the Looker project based on your forked repository, you can customize the L
Required Parameters
> ⚠️ These required values are configured during the Marketplace Installation process, or if this Block was installed from a forked Git repository, you will update the values for these constants in the `manifest.lkml` file for the project.
-- **Connection**: Value of the BigQuery CONNECTION_NAME allowing Looker to query the Cortex REPORTING dataset.
+- **Connection**: Value of the BigQuery CONNECTION_NAME allowing Looker to query the Cortex REPORTING dataset. Note, to use Balance Sheet reporting [Persistent Derived Tables](https://cloud.google.com/looker/docs/db-config-google-bigquery#persistent-derived-tables-on-a-connection) must be enabled.
- **GCP Project ID**: The GCP project where the SAP reporting dataset resides in BigQuery (i.e., GCP project ID). [Identifying Project ID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects).
@@ -81,7 +81,7 @@ With the Looker project based on your forked repository, you can customize the L
Required User Attributes
-Dashboards require two Looker [user attributes](https://cloud.google.com/looker/docs/admin-panel-users-user-attributes) to work properly.
+Dashboards require four Looker [user attributes](https://cloud.google.com/looker/docs/admin-panel-users-user-attributes) to work properly.
A Looker Admin should create the following user attributes and set their default values.
> ⚠️ Name each user attribute exactly as listed below:
@@ -89,14 +89,16 @@ A Looker Admin should create the following user attributes and set their default
| **Required User Attribute Name** | **Label** | **Data Type** | **User Access** | **Hide Value** | **Default Value** |
|----------------------------------|--------------------------------------|---------------|-----------------|----------------|-------------------|
| default_value_currency_required | SAP Default Currency to Display | String | Edit | No | `USD` or _desired currency like EUR, CAD or JPY_ |
-| client_id_rep | SAP Client Id (mandt) for Reporting | String | Edit | No | _Enter your SAP Client ID_ or `100` if using the provided test data |
+| client_id_rep | SAP Client Id (mandt) for Reporting | String | Edit | No | Enter your _SAP Client ID_ or `100` if using the provided test data |
+| sap_use_demo_data | SAP: Use Demo Data (Yes or No) | String | Edit | No | Enter `Yes` if using the provided test data. Otherwise, enter `No` |
+| sap_sql_flavor | SAP: SQL Flavor (ECC or S4) | String | View | No | Enter `ECC` or `S4` as required for your SAP system |
Each dashboard user can personalize these values by following these [instructions](https://cloud.google.com/looker/docs/user-account).
Other Considerations
-- **Persistent Derived Tables**: If using this block with production data, you may want to convert some derived tables to [Persistent Derived Tables (PDTs)](https://cloud.google.com/looker/docs/derived-tables#use_cases_for_pdts) to improve query performance. Ensure your BigQuery Connection has enabled PDTs, then update any derived table syntax with the desired [persistence strategy](https://cloud.google.com/looker/docs/derived-tables#persistence_strategies).
+- **Persistent Derived Tables**: Required for using Balance Sheet dasbhoards. And if using this block with production data, you may want to convert some derived tables to [Persistent Derived Tables (PDTs)](https://cloud.google.com/looker/docs/derived-tables#use_cases_for_pdts) to improve query performance. Ensure your BigQuery Connection has enabled PDTs, then update any derived table syntax with the desired [persistence strategy](https://cloud.google.com/looker/docs/derived-tables#persistence_strategies).
- **Locale**: The Looker user [locale](https://cloud.google.com/looker/docs/model-localization#assigning_users_to_a_locale) setting (as seen in account profile) maps to SAP language code for _BalanceSheet_, _Materials_MD_, _Vendor Performance_, and _Inventory Metrics Overview_ views and determines material text language. See [language_map](views/language_map.view.lkml) for details.
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 7bfafe97..9672befe 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,3 +1,20 @@
+## Release v5.3.1
+* Balance Sheet Updates:
+ * Added the Persistent Derived Table (PDT) view `balance_sheet_path_to_node_pdt` and Datagroup `balance_sheet_node_count`. This PDT finds the full hierarchy path to each Balance Sheet node (e.g., Assets/Current Assets/Cash & Equivalents). This PDT will regenerate if the count of Client, Chart of Accounts, Hierarchy Name, Level, and Node changes. Requires BigQuery connection used for this LookML model to have [Persistent Derived Tables](https://cloud.google.com/looker/docs/db-config-google-bigquery#persistent-derived-tables-on-a-connection) enabled.
+ * Updated Balance Sheet dashboards by:
+ * including three levels of the hierarchy as specified by user
+ * adding filter for Ledger
+ * renaming dashboards and select filters to more business-friendly terms
+ * modifying the sort order for columns and rows
+ * adding defaults for select filters based on user attributes for SQL Flavor (S4 or ECC) and Use of Test Data (Yes or No)
+ * Added the following user attributes to set default values for select filters used in the balance sheet dashboard. A Looker Admin will need to add these user attributes to Looker (see README doc for more details) or update LookML dashboards to use other defaults.
+ * `sap_use_demo_data`: set to _Yes_ if using the test data included with the Cortex Framework
+ * `sap_sap_sql_flavor`: set to either _S4_ or _ECC_ depending upon your SAP system
+
+* Accounts Receivable Updates:
+ * Added the Persistent Derived Table (PDT) view `global_currency_list_pdt`, an Explore based on this view and a Datagroup named `monthly_on_day_1`. Generated on the 1st day of the month, this PDT provides a unique list of _ToCurrency_TCURR_ values that are used for filter suggestions. To adjust the update frequency of a particular PDT, a Looker developer or admin can modify the associated Datagroup trigger.
+ * In the `data_intelligence_ar` view, for the _Currency_Required_ parameter, replaced the allowed values with the suggest_dimension _global_currency_list_pdt.to_currency_tcurr_.
+
## Release v5.3
* Added views, explores and dashboards to support `Balance Sheet` reporting
* Added constants to the `manifest` to allow for the reuse of HTML value formatting and comparison period logic used in the Balance Sheet.
diff --git a/components/datagroups.lkml b/components/datagroups.lkml
new file mode 100644
index 00000000..8199a27f
--- /dev/null
+++ b/components/datagroups.lkml
@@ -0,0 +1,22 @@
+datagroup: balance_sheet_node_count {
+ sql_trigger:
+ SELECT count(0)
+ FROM (
+ SELECT
+ Client,
+ ChartOfAccounts,
+ HierarchyName,
+ Level,
+ Node
+ FROM
+ `@{GCP_PROJECT}.@{REPORTING_DATASET}.BalanceSheet`
+ GROUP BY
+ 1, 2, 3, 4, 5) t ;;
+
+ description: "Triggered when the Number of Distinct Client, Chart of Accounts, HierarchyName, Level and Nodes changes"
+}
+
+datagroup: monthly_on_day_1 {
+ sql_trigger: select extract(month from current_date) ;;
+ description: "Triggers on first day of the month"
+}
diff --git a/explores_balance_sheet/balance_sheet.explore.lkml b/explores_balance_sheet/balance_sheet.explore.lkml
index d5e52397..1af30ed6 100644
--- a/explores_balance_sheet/balance_sheet.explore.lkml
+++ b/explores_balance_sheet/balance_sheet.explore.lkml
@@ -1,5 +1,6 @@
include: "/views/balance_sheet_rfn.view"
include: "/views/language_map_sdt.view"
+include: "/views/balance_sheet_hierarchy_selection_sdt.view"
explore: balance_sheet {
always_join: [language_map_sdt]
@@ -21,4 +22,15 @@ explore: balance_sheet {
sql_on: ${balance_sheet.language_key_spras} = ${language_map_sdt.language_spras} ;;
fields: []
}
+
+ join: balance_sheet_hierarchy_selection_sdt {
+ type: inner
+ relationship: many_to_one
+ sql_on: ${balance_sheet.client_mandt} = ${balance_sheet_hierarchy_selection_sdt.client_mandt} and
+ ${balance_sheet.hierarchy_name} = ${balance_sheet_hierarchy_selection_sdt.hierarchy_name} and
+ ${balance_sheet.chart_of_accounts} = ${balance_sheet_hierarchy_selection_sdt.chart_of_accounts} and
+ ${balance_sheet.language_key_spras} = ${balance_sheet_hierarchy_selection_sdt.language_key_spras} and
+ ${balance_sheet.node} = ${balance_sheet_hierarchy_selection_sdt.node};;
+
+ }
}
diff --git a/manifest.lkml b/manifest.lkml
index a5f8662e..09fdae7f 100644
--- a/manifest.lkml
+++ b/manifest.lkml
@@ -4,7 +4,7 @@ constant: CONNECTION_NAME {
}
constant: GCP_PROJECT {
- value: "GCP Project Name"
+ value: "GCP Project ID"
export: override_required
}
@@ -38,7 +38,7 @@ constant: negative_format {
# used to derive previous previous period when 1st period is selected
constant: max_fiscal_period {
value: "12"
- export: override_optional
+
}
# comparison period derived based on select_comparison_type parameter:
@@ -50,33 +50,31 @@ constant: derive_comparison_period {
value: "{% assign comparison_type = select_comparison_type._parameter_value %}
{% assign fp = select_fiscal_period._parameter_value %}
{% assign cp = select_custom_comparison_period._parameter_value %}
- {% assign max_fp_size = '@{max_fiscal_period}' | remove_first: '0' | size | times: 1 %}
+ {% assign max_fp_size = '3' | times: 1 %}
{% assign max_fp_size_neg = max_fp_size | times: -1 %}
- {% assign pad = '' %}
- {% for i in (1..max_fp_size) %}
- {% assign pad = pad | append: '0' %}
- {% endfor %}
+ {% assign pad = '00' %}
+
{% if comparison_type == 'custom' %}
- {% if fp == cp %}{% assign comparison_type = 'none' %}
- {% elsif cp == '' %}{% assign comparison_type = 'yoy' %}
- {% endif %}
+ {% if fp == cp %}{% assign comparison_type = 'none' %}
+ {% elsif cp == '' %}{% assign comparison_type = 'yoy' %}
+ {% endif %}
{% endif %}
- {% if comparison_type == 'prior' or comparison_type == 'yoy' %}
- {% assign p_array = fp | split: '.' %}
- {% if comparison_type == 'prior' %}
- {% if p_array[1] == '001' or p_array[1] == '01' %}
- {% assign m = '@{max_fiscal_period}' %}{% assign sub_yr = 1 %}
+ {% if comparison_type == 'prior' or comparison_type == 'yoy' %}
+ {% assign p_array = fp | split: '.' %}
+ {% if comparison_type == 'prior' %}
+ {% if p_array[1] == '001' %}
+ {% assign m = '@{max_fiscal_period}' | prepend: pad | slice: max_fp_size_neg, max_fp_size %}{% assign sub_yr = 1 %}
{% else %}
- {% assign m = p_array[1] | times: 1 | minus: 1 | prepend: pad | slice: max_fp_size_neg, max_fp_size %}{% assign sub_yr = 0 %}
- {% endif %}
- {% else %}
- {% assign m = p_array[1] %}{% assign sub_yr = 1 %}
- {% endif %}
+ {% assign m = p_array[1] | times: 1 | minus: 1 | prepend: pad | slice: max_fp_size_neg, max_fp_size %}{% assign sub_yr = 0 %}
+ {% endif %}
+ {% else %}
+ {% assign m = p_array[1] %}{% assign sub_yr = 1 %}
+ {% endif %}
{% assign yr = p_array[0] | times: 1 | minus: sub_yr %}
{% assign cp = yr | append: '.'| append: m %}
- {% elsif comparison_type == 'none' %} {% assign cp = '' %}
- {% endif %}"
+ {% elsif comparison_type == 'none' %} {% assign cp = '' %}
+ {% endif %}"
}
#} end additional constants
diff --git a/models/cortex_sap_operational.model.lkml b/models/cortex_sap_operational.model.lkml
index fd2b8307..5c72f2fa 100644
--- a/models/cortex_sap_operational.model.lkml
+++ b/models/cortex_sap_operational.model.lkml
@@ -283,3 +283,8 @@ explore: inventory_by_plant {
}
################################################ End of Supply Chain #################################################
+
+explore: global_currency_list_pdt {
+ hidden: yes
+ description: "Used to provide filter suggestions for Global Currency"
+}
diff --git a/views/balance_sheet_hierarchy_selection_sdt.view.lkml b/views/balance_sheet_hierarchy_selection_sdt.view.lkml
new file mode 100644
index 00000000..6ee177c7
--- /dev/null
+++ b/views/balance_sheet_hierarchy_selection_sdt.view.lkml
@@ -0,0 +1,201 @@
+#########################################################
+# This SQL Derived Table (sdt):
+# 1) Takes user inputs from parameters:
+# parameter_pick_start_level - select top level of hierarchy to show
+# parameter_pick_depth_level - how many levels should be shown (1 to 5 levels)
+# 2) Derives node_text and node values for hier1 to hier5 by placing the top level selected by user into hier_1 and subsequent levels into hier2 to hier5
+# 3) Filters to the last level selected by user. For example, if Top Level to Display of 2 and a depth of 3 is selected:
+# level = 5
+# derived as: 0 (start) + 3 (depth) + 2 (adjustment because minimum level possible = 2)
+#
+# If more than 5 hierarchy levels are needed, update the parameter_pick_depth_level and add additional hierN dimensions for node and node_text
+#
+#########################################################
+
+include: "/views/balance_sheet_path_to_node_pdt.view"
+view: balance_sheet_hierarchy_selection_sdt {
+ derived_table: {
+ sql:
+ {% assign start = parameter_pick_start_level._parameter_value | times: 1 | minus: 2 %}
+ {% assign depth = parameter_pick_depth_level._parameter_value | times: 1 | minus: 1 %}
+ select
+ h.Client,
+ h.ChartOfAccounts,
+ h.HierarchyName,
+ LanguageKey_SPRAS,
+ LevelNumber,
+ LevelSequenceNumber,
+ Node,
+ NodeText,
+ NodeTextPath_String,
+ NodePath_String,
+ NodeTextPath[SAFE_OFFSET({{start}})] AS hier1_node_text,
+ NodeTextPath[SAFE_OFFSET({{start | plus: 1}})] AS hier2_node_text,
+ NodeTextPath[SAFE_OFFSET({{start | plus: 2}})] AS hier3_node_text,
+ NodeTextPath[SAFE_OFFSET({{start | plus: 3}})] AS hier4_node_text,
+ NodeTextPath[SAFE_OFFSET({{start | plus: 4}})] AS hier5_node_text,
+ NodePath[SAFE_OFFSET({{start}})] AS hier1_node,
+ NodePath[SAFE_OFFSET({{start | plus: 1}})] AS hier2_node,
+ NodePath[SAFE_OFFSET({{start | plus: 2}})] AS hier3_node,
+ NodePath[SAFE_OFFSET({{start | plus: 3}})] AS hier4_node,
+ NodePath[SAFE_OFFSET({{start | plus: 4}})] AS hier5_node
+ from ${balance_sheet_path_to_node_pdt.SQL_TABLE_NAME} h
+ where
+ --filter to ending level as start + depth + 2 (add 2 as minimum level is 2)
+ --cap at Max Number of Levels if requested depth exceeds
+ LevelNumber = least({{start}} + {{depth}} + 2,MaxLevelNumber)
+ ;;
+ }
+
+ label: "Balance Sheet"
+ fields_hidden_by_default: yes
+
+ parameter: parameter_pick_start_level {
+ hidden: no
+ type: unquoted
+ view_label: "🗓 Pick Fiscal Periods"
+ label: "Select Top Hierarchy Level to Display"
+ suggest_explore: balance_sheet
+ suggest_dimension: balance_sheet.level_string
+ default_value: "2"
+ }
+
+ parameter: parameter_pick_depth_level {
+ hidden: no
+ type: unquoted
+ view_label: "🗓 Pick Fiscal Periods"
+ label: "Select Number of Hierarchy Levels to Display"
+ description: "Select number of hierarchy levels (1 to 5) to display"
+ allowed_value: {value: "1"}
+ allowed_value: {value: "2"}
+ allowed_value: {value: "3"}
+ allowed_value: {value: "4"}
+ allowed_value: {value: "5"}
+ default_value: "3"
+ }
+
+ dimension: key {
+ hidden: yes
+ type: string
+ primary_key: yes
+ sql: concat(${client_mandt},${hierarchy_name},${chart_of_accounts},${language_key_spras},${node}) ;;
+ }
+
+ dimension: client_mandt {
+ type: string
+ sql: ${TABLE}.client ;;
+ }
+
+ dimension: chart_of_accounts {
+ type: string
+ sql: ${TABLE}.ChartOfAccounts ;;
+ }
+
+ dimension: hierarchy_name {
+ type: string
+ sql: ${TABLE}.HierarchyName ;;
+ }
+
+ dimension: language_key_spras {
+ type: string
+ sql: ${TABLE}.LanguageKey_SPRAS ;;
+ }
+
+ dimension: level_number {
+ type: number
+ sql: ${TABLE}.LevelNumber ;;
+ }
+
+ dimension: node {
+ type: string
+ sql: ${TABLE}.node ;;
+ }
+
+ dimension: node_text {
+ type: string
+ sql: ${TABLE}.NodeText ;;
+ }
+
+ dimension: node_text_path_string {
+ hidden: no
+ type: string
+ sql: ${TABLE}.NodeTextPath_String ;;
+ }
+
+ dimension: node_path_string {
+ hidden: no
+ type: string
+ sql: ${TABLE}.NodePath_String ;;
+ }
+
+ dimension: hier1_node_text {
+ hidden: no
+ type: string
+ sql: ${TABLE}.hier1_node_text ;;
+ order_by_field: hier1_node
+ }
+
+ dimension: hier2_node_text {
+ hidden: no
+ type: string
+ sql: ${TABLE}.hier2_node_text ;;
+ order_by_field: hier2_node
+ }
+
+ dimension: hier3_node_text {
+ hidden: no
+ type: string
+ sql: ${TABLE}.hier3_node_text ;;
+ order_by_field: hier3_node
+ }
+
+ dimension: hier4_node_text {
+ hidden: no
+ type: string
+ sql: ${TABLE}.hier4_node_text ;;
+ order_by_field: hier4_node
+ }
+
+ dimension: hier5_node_text {
+ hidden: no
+ type: string
+ sql: ${TABLE}.hier5_node_text ;;
+ order_by_field: hier5_node
+ }
+
+ dimension: hier1_node {
+ hidden: no
+ description: "First level of hierarchy to display"
+ type: string
+ sql: ${TABLE}.hier1_node ;;
+ }
+
+ dimension: hier2_node {
+ hidden: no
+ description: "Second level of hierarchy to display"
+ type: string
+ sql: ${TABLE}.hier2_node ;;
+ }
+
+ dimension: hier3_node {
+ hidden: no
+ description: "Third level of hierarchy to display"
+ type: string
+ sql: ${TABLE}.hier3_node ;;
+ }
+
+ dimension: hier4_node {
+ hidden: no
+ description: "Fourth level of hierarchy to display"
+ type: string
+ sql: ${TABLE}.hier4_node ;;
+ }
+
+ dimension: hier5_node {
+ hidden: no
+ description: "Fifth level of hierarchy to display"
+ type: string
+ sql: ${TABLE}.hier5_node ;;
+ }
+
+ }
diff --git a/views/balance_sheet_path_to_node_pdt.view.lkml b/views/balance_sheet_path_to_node_pdt.view.lkml
new file mode 100644
index 00000000..b8f66330
--- /dev/null
+++ b/views/balance_sheet_path_to_node_pdt.view.lkml
@@ -0,0 +1,93 @@
+#########################################################
+# this Persistent Derived Table (pdt) derives the full path to a node (e.g., Assets/Current Assets/Cash & Equivalents)
+#
+# Uses RECURSIVE to navigate the parent-child relationships and derive the full path
+# This view is only referenced in the view balance_sheet_hierarchy_selection_sdt
+#########################################################
+
+view: balance_sheet_path_to_node_pdt {
+ derived_table: {
+ datagroup_trigger: balance_sheet_node_count
+ create_process: {
+ sql_step:
+
+ CREATE OR REPLACE TABLE ${SQL_TABLE_NAME} as
+ WITH
+ RECURSIVE n AS (
+ SELECT
+ Client,
+ ChartOfAccounts,
+ HierarchyName,
+ LanguageKey_SPRAS,
+ CAST(Level AS INT64) AS LevelNumber,
+ Parent,
+ COALESCE(REGEXP_REPLACE(ParentText,'Non[- ]Current','Noncurrent'),Parent) AS ParentText,
+ Node,
+ COALESCE(REGEXP_REPLACE(NodeText,'Non[- ]Current','Noncurrent'),Node) AS NodeText
+ FROM
+ `@{GCP_PROJECT}.@{REPORTING_DATASET}.BalanceSheet`
+ GROUP BY
+ 1, 2, 3, 4, 5, 6, 7, 8, 9 ),
+ iterations AS (
+ SELECT
+ Client,
+ ChartOfAccounts,
+ HierarchyName,
+ LanguageKey_SPRAS,
+ LevelNumber,
+ Node,
+ NodeText,
+ Parent,
+ ParentText,
+ 0 AS LevelSequenceNumber,
+ nodeText AS NodeTextPath_String,
+ Node AS NodePath_String
+ FROM
+ n
+ WHERE
+ LevelNumber = 2
+ UNION ALL
+ SELECT
+ n.Client,
+ n.ChartOfAccounts,
+ n.HierarchyName,
+ n.LanguageKey_SPRAS,
+ n.LevelNumber,
+ n.Node,
+ n.NodeText,
+ n.Parent,
+ n.ParentText,
+ LevelSequenceNumber+1 AS LevelSequenceNumber,
+ CONCAT(NodeTextPath_String, '/',n.NodeText) AS NodeTextPath_String,
+ CONCAT(NodePath_String, '/',n.Node) AS NodePath_String
+ FROM
+ n
+ JOIN
+ iterations i
+ ON
+ i.node = n.Parent
+ AND i.Client = n.Client
+ AND i.ChartOfAccounts = n.ChartOfAccounts
+ AND i.HierarchyName = n.HierarchyName
+ AND i.LanguageKey_SPRAS = n.LanguageKey_SPRAS
+ )
+ select Client,
+ ChartOfAccounts,
+ HierarchyName,
+ LanguageKey_SPRAS,
+ Node,
+ NodeText,
+ ParentText,
+ LevelNumber,
+ LevelSequenceNumber,
+ max(LevelNumber) over (partition by Client,ChartOfAccounts,HierarchyName) as MaxLevelNumber,
+ NodeTextPath_String,
+ NodePath_String,
+ split(NodeTextPath_String,'/') as NodeTextPath,
+ split(NodePath_String,'/') as NodePath
+ from iterations
+
+ ;;
+ }
+ }
+}
diff --git a/views/balance_sheet_rfn.view.lkml b/views/balance_sheet_rfn.view.lkml
index a5b94a66..e94d0b06 100644
--- a/views/balance_sheet_rfn.view.lkml
+++ b/views/balance_sheet_rfn.view.lkml
@@ -18,7 +18,7 @@
# Exchange Rate (based on last date in the period)
# Avg Exchange Rate, Max Exchange Rate
#
-# To query this table, should always include Fiscal Year and Fiscal Period as dimensions
+# To query this table, always include Fiscal Year and Fiscal Period as dimensions
# and filter to:
# - a single Client MANDT (handled with Constant defined in Manifest file)
# - a single Language (the Explore based on this view uses User Attribute locale to select language in joined view language_map_sdt)
@@ -37,7 +37,7 @@ view: +balance_sheet {
primary_key: yes
hidden: yes
sql: concat(${client},${company_code}, ${chart_of_accounts}, ${hierarchy_name},
- coalesce(${business_area},'is null') ,coalesce(${ledger_in_general_ledger_accounting},'is null')
+ coalesce(${business_area},'is null') ,coalesce(${ledger_in_general_ledger_accounting},'0L')
,${node},${fiscal_year},${fiscal_period},${language_key_spras},${target_currency_tcurr});;
}
@@ -51,7 +51,8 @@ view: +balance_sheet {
#
# use parameter selections to define fiscal_period_group values of 'Reporting' or 'Comparison'
#
-# at explore level if select_fiscal_period in query then filter where fiscal_period_group is null
+# a sql_always_where clause defined at explore level will
+# filter where fiscal_period_group is null if select_fiscal_period is in the query
#########################################################
parameter: select_fiscal_period {
@@ -76,10 +77,9 @@ view: +balance_sheet {
label: "Previous Fiscal Period" value: "prior"
}
allowed_value: {
- label: "Custom Range" value: "custom"
+ label: "Custom Comparison Period" value: "custom"
}
default_value: "yoy"
-
}
parameter: select_custom_comparison_period {
@@ -125,6 +125,22 @@ view: +balance_sheet {
dimension: ledger_in_general_ledger_accounting {
label: "Ledger"
description: "Ledger in General Ledger Accounting"
+ sql: coalesce(${TABLE}.LedgerInGeneralLedgerAccounting,'0L') ;;
+ }
+
+ dimension: ledger_name {
+ description: "Ledger in General Ledger Accounting"
+ # sql: if(${ledger_in_general_ledger_accounting} = '0L','Leading Ledger', ${ledger_in_general_ledger_accounting} );;
+ sql: case ${ledger_in_general_ledger_accounting}
+ when '0L' then '0L - Leading Ledger'
+ when '2L' then '2L - IFRS Non-leading Ledger'
+ when '0E' then '0E - Extension Ledger'
+ else ${ledger_in_general_ledger_accounting} end;;
+ order_by_field: ledger_in_general_ledger_accounting
+ }
+
+ dimension: business_area {
+ sql: coalesce(${TABLE}.BusinessArea,'N/A') ;;
}
dimension: company_code {
@@ -146,8 +162,9 @@ view: +balance_sheet {
type: string
label: "Parent (text)"
description: "Parent (as text) of Hierarchy. For example, Assets is Parent with multiple Child Nodes like Current Assets and Non-Current Assets."
- sql: coalesce(${TABLE}.ParentText,${TABLE}.Parent) ;;
- order_by_field: parent_sort_order
+ # sql: coalesce(${TABLE}.ParentText,${TABLE}.Parent) ;;
+ sql: coalesce(regexp_replace(${TABLE}.ParentText,'Non[- ]Current','Noncurrent'),${TABLE}.Parent) ;;
+ order_by_field: parent
}
dimension: parent_sort_order {
type: string
@@ -164,34 +181,33 @@ view: +balance_sheet {
type: string
label: "Node (text)"
description: "Child Node (as text) of Hierarchy. For example, Assets is Parent with multiple Child Nodes like Current Assets and Non-Current Assets."
- sql: coalesce(${TABLE}.NodeText,${TABLE}.Node) ;;
- order_by_field: node_sort_order
- }
-
- dimension: node_sort_order {
- type: string
- hidden: yes
- sql: concat(${level_number},${parent},${node}) ;;
+ sql: coalesce(regexp_replace(${TABLE}.NodeText,'Non[- ]Current','Noncurrent'),${TABLE}.Node) ;;
+ order_by_field: node
}
dimension: level {
+ hidden: yes
description: "Shows the Parent-Child Relationship. For example depending on the Hierarchy selected, Level 02 will display FPA1 as the Parent with Assets and Liabilities & Equity as Child Nodes. Level 03 will display Assets as Parent with Current Assets and Non-Current Assets as Child Nodes."
}
dimension: level_number {
type: number
description: "Level as a numeric. Level shows the Parent-Child Relationship. For example depending on the Hierarchy selected, Level 2 will display FPA1 as the Parent with Assets and Liabilities & Equity as Child Nodes. Level 3 will display Assets as Parent with Current Assets and Non-Current Assets as Child Nodes."
-
sql: parse_numeric(${level}) ;;
}
+ dimension: level_string {
+ type: string
+ label: "Level"
+ description: "Level as a numeric. Level shows the Parent-Child Relationship. For example depending on the Hierarchy selected, Level 2 will display FPA1 as the Parent with Assets and Liabilities & Equity as Child Nodes. Level 3 will display Assets as Parent with Current Assets and Non-Current Assets as Child Nodes."
+ sql: ltrim(${level},'0') ;;
+ }
+
dimension: is_leaf_node {
description: "Yes if GL Account Number and indicates lowest level of hierarchy."
}
-
-
# Fiscal Year and Period and other forms of Fiscal Dates
# {
dimension: fiscal_period {
@@ -222,20 +238,24 @@ view: +balance_sheet {
hidden: no
type: number
group_label: "Fiscal Dates"
- description: "Fiscal Year and Period as a Numeric Value in form of YYYYPP or YYYYPPP"
- sql: {% assign max_fp_size = '@{max_fiscal_period}' | remove_first: '0' | size | times: 1 %}
- {% if max_fp_size == 2 %} {% assign fp = 'right(${fiscal_period},2)'%}{%else%}{%assign fp = '${fiscal_period}' %}{%endif%}
- parse_numeric(concat(${fiscal_year},{{fp}})) ;;
+ description: "Fiscal Year and Period as a Numeric Value in form of YYYYPPP"
+ sql: parse_numeric(concat(${fiscal_year},${fiscal_period})) ;;
value_format_name: id
}
+ # used in order_by_field to sort fiscal year period in descending order
+ dimension: fiscal_year_period_negative_number {
+ hidden: yes
+ type: number
+ sql: -1 * ${fiscal_year_period_number} ;;
+ }
+
dimension: fiscal_year_period {
type: string
group_label: "Fiscal Dates"
- description: "Fiscal Year and Period as String in form of YYYY.PP or YYYY.PPP"
- sql: {% assign max_fp_size = '@{max_fiscal_period}' | remove_first: '0' | size | times: 1 %}
- {% if max_fp_size == 2 %} {% assign fp = 'right(${fiscal_period},2)'%}{%else%}{%assign fp = '${fiscal_period}' %}{%endif%}
- concat(${fiscal_year},'.',{{fp}});;
+ description: "Fiscal Year and Period as String in form of YYYY.PPP"
+ sql: concat(${fiscal_year},'.',${fiscal_period});;
+ order_by_field: fiscal_year_period_negative_number
}
dimension: fiscal_year_quarter {
@@ -259,6 +279,7 @@ view: +balance_sheet {
# if yoy then subtract year from period
# if prior then subtract 1 from period (if period 001 then substract 1 year and use max_fiscal_period for period)
# if custom then use value from select_custom_comparison_period
+ # see manifest for full logic defined in constant derive_comparison_period
dimension: fiscal_period_group {
type: string
@@ -286,7 +307,7 @@ view: +balance_sheet {
#} end Fiscal Dates
-# Hidden dimensions that are restated as measures; Amounts and Exchange Rates
+# Hidden dimensions including those restated as measures like Amounts and Exchange Rates
# {
# hide client and define as client_mandt to match other SAP tables
dimension: client {
@@ -394,24 +415,20 @@ view: +balance_sheet {
type: number
group_label: "Reporting v Comparison Period Metrics"
label: "{% if select_fiscal_period._in_query %}
- @{derive_comparison_period}{{cp}}
- {% else %} Comparison Period Amount in Global Currency
- {% endif %}"
-
+ @{derive_comparison_period}{{cp}}
+ {% else %} Comparison Period Amount in Global Currency
+ {% endif %}"
description: "Cumulative Amount in Global Currency for the selected Fiscal Comparison Period"
- # sql: ${cumulative_amount_in_target_currency} ;;
sql: sum(case ${fiscal_period_group} when "Comparison" then ${cumulative_amount_in_target_currency} else null end) ;;
- # filters: [fiscal_period_group: "Comparison"]
value_format_name: millions_d1
html: @{negative_format} ;;
}
-
measure: difference_value {
type: number
group_label: "Reporting v Comparison Period Metrics"
- label: "Var"
- description: "Reporting Period Amount - Comparison Period Amount"
+ label: "Gain (Loss)"
+ description: "Reporting Period Amount minus Comparison Period Amount"
sql: ${reporting_period_amount_in_global_currency} - ${comparison_period_amount_in_global_currency} ;;
value_format_name: millions_d1
html: @{negative_format} ;;
@@ -422,12 +439,12 @@ view: +balance_sheet {
group_label: "Reporting v Comparison Period Metrics"
label: "Var %"
description: "Percentage Change between Reporting and Comparison Periods"
- sql: safe_divide(${reporting_period_amount_in_global_currency},${comparison_period_amount_in_global_currency}) - 1 ;;
+ sql: safe_divide( (${reporting_period_amount_in_global_currency} - ${comparison_period_amount_in_global_currency}),abs(${comparison_period_amount_in_global_currency})) ;;
value_format_name: percent_1
html: @{negative_format} ;;
}
- # used in Balance Sheet dashboard, added to a single-value visualization
+ # used in Balance Sheet dashboard; add to a single-value visualization
measure: title_balance_sheet {
type: number
description: "Used in Balance Sheet dashboard as Summary visualization with Company, Global Currency, Fiscal Period and Current Ratio."
@@ -436,7 +453,7 @@ view: +balance_sheet {
@@ -470,6 +487,12 @@ view: +balance_sheet {
value_format_name: decimal_4
}
+ measure: max_fiscal_year_period {
+ type: max
+ sql: ${fiscal_year_period_number} ;;
+ value_format_name: id
+ }
+
#} end measures
diff --git a/views/data_intelligence_ar.view.lkml b/views/data_intelligence_ar.view.lkml
index b201bbc5..65a5125e 100644
--- a/views/data_intelligence_ar.view.lkml
+++ b/views/data_intelligence_ar.view.lkml
@@ -12,22 +12,8 @@ view: data_intelligence_ar {
parameter: Currency_Required{
type: string
- allowed_value: {
- label: "USD"
- value: "USD"
- }
- allowed_value: {
- label: "EUR"
- value: "EUR"
- }
- allowed_value: {
- label: "CAD"
- value: "CAD"
- }
- allowed_value: {
- label: "JPY"
- value: "JPY"
- }
+ suggest_explore: global_currency_list_pdt
+ suggest_dimension: global_currency_list_pdt.to_currency_tcurr
default_value: "USD"
}
diff --git a/views/fiscal_periods_sdt.view.lkml b/views/fiscal_periods_sdt.view.lkml
index 21e79800..749df213 100644
--- a/views/fiscal_periods_sdt.view.lkml
+++ b/views/fiscal_periods_sdt.view.lkml
@@ -1,5 +1,6 @@
######################
# Finds the Fiscal Years and Periods available in Balance Sheet
+#
# Used as source for Fiscal Period parameter or filter selections
# Depending on max_fp_size, fiscal_year_period will display either YYYY.PP or YYYY.PPP
# includes dimension negative_fiscal_year_period_number which:
@@ -10,22 +11,21 @@
view: fiscal_periods_sdt {
derived_table: {
sql:
- {% assign max_fp_size = '@{max_fiscal_period}' | remove_first: '0' | size | times: 1 %}
- {% if max_fp_size == 2 %}{% assign fp = 'right(b.FiscalPeriod,2)'%}
- {% else %}{%assign fp = 'b.FiscalPeriod' %}{%endif%}
select
- FiscalYear as fiscal_year,
- FiscalPeriod as fiscal_period,
- concat(b.FiscalYear,'.Q',b.FiscalQuarter) as fiscal_year_quarter,
- concat(b.FiscalYear,'.',{{fp}}) AS fiscal_year_period,
- parse_numeric(concat(b.FiscalYear,{{fp}})) * -1 as negative_fiscal_year_period_number
+ FiscalYear as fiscal_year,
+ FiscalPeriod as fiscal_period,
+ concat(b.FiscalYear,'.Q',b.FiscalQuarter) as fiscal_year_quarter,
+ concat(b.FiscalYear,'.',b.FiscalPeriod) AS fiscal_year_period,
+ parse_numeric(concat(b.FiscalYear,b.FiscalPeriod)) * -1 as negative_fiscal_year_period_number,
+ parse_numeric(concat(b.FiscalYear,b.FiscalQuarter)) * -1 as negative_fiscal_year_quarter_number
FROM `@{GCP_PROJECT}.@{REPORTING_DATASET}.BalanceSheet` AS b
- group by fiscal_year,
- fiscal_period,
- fiscal_year_quarter,
- fiscal_year_period,
- negative_fiscal_year_period_number
- ;;
+ GROUP BY
+ fiscal_year,
+ fiscal_period,
+ fiscal_year_quarter,
+ fiscal_year_period,
+ negative_fiscal_year_period_number,
+ negative_fiscal_year_quarter_number;;
}
dimension: fiscal_year {
@@ -56,5 +56,11 @@ view: fiscal_periods_sdt {
sql: ${TABLE}.negative_fiscal_year_period_number ;;
}
+ dimension: negative_fiscal_year_quarter_number {
+ hidden: yes
+ type: number
+ sql: ${TABLE}.negative_fiscal_year_quarter_number ;;
+ }
+
}
diff --git a/views/global_currency_list_pdt.view.lkml b/views/global_currency_list_pdt.view.lkml
new file mode 100644
index 00000000..b8b37d7f
--- /dev/null
+++ b/views/global_currency_list_pdt.view.lkml
@@ -0,0 +1,39 @@
+######################
+# this Persistent Derived Table view finds the distinct list of TCURR values found in CurrencyConversion
+#
+# recommend setting a data trigger based on how often the TCURR value is expected to change
+# datagroup trigger set initially as Monthly on First day of month. To use a different trigger:
+# 1. define datagroup in datagroups.lkml file found in components folder
+# 2. replace datagroup_trigger: value below with name of datagroup
+#
+# this view is used in Explore Global Currency List to provide suggestions for Global/Target Currency filter values and Exchange Rate Type parameter values
+#
+######################
+
+view: global_currency_list_pdt {
+ derived_table: {
+ datagroup_trigger: monthly_on_day_1
+
+ sql: SELECT
+ DISTINCT ExchangeRateType_KURST,
+ ToCurrency_TCURR
+ FROM
+ `@{GCP_PROJECT}.@{REPORTING_DATASET}.CurrencyConversion` ;;
+ }
+
+ dimension: key {
+ primary_key: yes
+ sql: concat(${exchange_rate_type_kurst}, ${to_currency_tcurr}) ;;
+ }
+
+ dimension: exchange_rate_type_kurst {
+ type: string
+ sql: ${TABLE}.ExchangeRateType_KURST ;;
+ }
+
+ dimension: to_currency_tcurr {
+ type: string
+ sql: ${TABLE}.ToCurrency_TCURR ;;
+ }
+
+}