20260428
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ table Dim_CorpType
|
||||
column Value2
|
||||
formatString: 0
|
||||
lineageTag: 4ceee4f1-6bd8-4dc1-96fe-c6b217b82199
|
||||
summarizeBy: sum
|
||||
summarizeBy: none
|
||||
isNameInferred
|
||||
sourceColumn: [Value2]
|
||||
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
table Fact_Direct_Retail_national_corp_rank
|
||||
lineageTag: 40ba891d-21b7-4ded-ac27-2847d846b960
|
||||
|
||||
column ta
|
||||
dataType: string
|
||||
lineageTag: 084c7c9e-f894-4b90-8054-8a15c1547f58
|
||||
summarizeBy: none
|
||||
sourceColumn: ta
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column rx_otc
|
||||
dataType: string
|
||||
lineageTag: d3dd8860-ffd6-485c-a4e2-ae2bc7999d34
|
||||
summarizeBy: none
|
||||
sourceColumn: rx_otc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top_top_incre
|
||||
dataType: string
|
||||
lineageTag: 7770673c-6d22-4ade-be5c-03a7fefe5481
|
||||
summarizeBy: none
|
||||
sourceColumn: top_top_incre
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column rank
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: 662038a3-f31b-47cf-bef0-9c1c654674db
|
||||
summarizeBy: sum
|
||||
sourceColumn: rank
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corp_desc
|
||||
dataType: string
|
||||
lineageTag: 9d636602-be91-480d-956e-9ef2e0d06449
|
||||
summarizeBy: none
|
||||
sourceColumn: corp_desc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corp_cod
|
||||
dataType: string
|
||||
lineageTag: 4c499c6e-cb18-486f-935f-1bb90e5af521
|
||||
summarizeBy: none
|
||||
sourceColumn: corp_cod
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corporation
|
||||
dataType: string
|
||||
lineageTag: 181bec37-3634-4931-9aeb-16cc5b163b79
|
||||
summarizeBy: none
|
||||
sourceColumn: corporation
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column type
|
||||
dataType: string
|
||||
lineageTag: fa408084-c658-4a22-a93f-d87be8b9b45c
|
||||
summarizeBy: none
|
||||
sourceColumn: type
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_quarter_num
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: 4bfbf1f6-ca26-4ef8-9734-52a84f64095a
|
||||
summarizeBy: none
|
||||
sourceColumn: sales_quarter_num
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_amount
|
||||
dataType: double
|
||||
lineageTag: 081e3e8b-7ef4-4bf0-969d-f1a54947856c
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_amount
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column sales_amount_ly
|
||||
dataType: double
|
||||
lineageTag: 7ab3e16a-3c63-4818-a3ec-c7b725a829c5
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_amount_ly
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
partition Fact_Direct_Retail_national_corp_rank = m
|
||||
mode: import
|
||||
queryGroup: Fact_Sales
|
||||
source = ```
|
||||
let
|
||||
Source =
|
||||
Value.NativeQuery(
|
||||
Databricks.Catalogs(
|
||||
ServerAddress, HttpPath, [
|
||||
Catalog = CatalogName,
|
||||
Database = null,
|
||||
EnableAutomaticProxyDiscovery = null,EnableQueryResultDownload="0"
|
||||
]
|
||||
){
|
||||
[Name = CatalogName, Kind = "Database"]
|
||||
}[Data],
|
||||
"
|
||||
SELECT
|
||||
a.ta,
|
||||
a.rx_otc,
|
||||
a.top_top_incre,
|
||||
CAST(a.rank1 AS INT) AS rank,
|
||||
a.corp_desc,
|
||||
c.corp_cod,
|
||||
a.corporation,
|
||||
a.type,
|
||||
CAST(
|
||||
CONCAT(
|
||||
SUBSTR(a.sales_quarter, 1, 4),
|
||||
LPAD(CAST(CAST(SUBSTR(a.sales_quarter, 6, 1) AS INT) * 3 AS STRING), 2, '0')
|
||||
) AS INT
|
||||
) AS sales_quarter_num,
|
||||
CAST(a.sales_amount * 1000000 AS DECIMAL(20, 2)) AS sales_amount,
|
||||
CAST(b.sales_amount * 1000000 AS DECIMAL(20, 2)) AS sales_amount_ly
|
||||
FROM
|
||||
dwd.dwd_gnd_retail_national_corp_rank a
|
||||
LEFT JOIN dwd.dwd_gnd_retail_national_corp_rank b
|
||||
ON coalesce(a.ta ,'') = coalesce(b.ta,'')
|
||||
AND coalesce(a.rx_otc ,'') = coalesce(b.rx_otc,'')
|
||||
AND coalesce(a.top_top_incre,'') = coalesce(b.top_top_incre,'')
|
||||
AND coalesce(a.corp_desc ,'') = coalesce(b.corp_desc,'')
|
||||
AND coalesce(a.type ,'') = coalesce(b.type,'')
|
||||
AND CONCAT(CAST(CAST(SUBSTR(a.sales_quarter, 1, 4) AS INT) - 1 AS STRING), SUBSTR(a.sales_quarter, 5)) = b.sales_quarter
|
||||
-- ^^^ '2024' - 1 = '2023' + 'Q1' => '2023Q1' = b.sales_quarter
|
||||
LEFT JOIN
|
||||
(SELECT ZK_Corp_C,max(CORP_COD) CORP_COD
|
||||
FROM dwd.dwd_inc_gnd_retail_b2c_label_total
|
||||
WHERE CORP_COD is NOT NULL GROUP BY ZK_Corp_C) c
|
||||
on a.corp_desc = c.zk_corp_c
|
||||
"
|
||||
& UsingLimit,
|
||||
null,
|
||||
[
|
||||
EnableFolding = true
|
||||
]
|
||||
)
|
||||
in
|
||||
Source
|
||||
```
|
||||
|
||||
annotation PBI_NavigationStepName = Navigation
|
||||
|
||||
annotation PBI_ResultType = Table
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
table Fact_Direct_Retail_national_prd_rank
|
||||
lineageTag: 42f2bb71-77d2-4839-bd67-a191c1bdd68d
|
||||
|
||||
column ta
|
||||
dataType: string
|
||||
lineageTag: 95780b78-e622-4b86-9eb9-d0bcb4775696
|
||||
summarizeBy: none
|
||||
sourceColumn: ta
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column rx_otc
|
||||
dataType: string
|
||||
lineageTag: 68a78c0d-164e-4b2f-a7df-ccbe1d74b55f
|
||||
summarizeBy: none
|
||||
sourceColumn: rx_otc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top_top_incre
|
||||
dataType: string
|
||||
lineageTag: 63eb87c6-91e8-463e-9e8b-eb6b4ed3b7a0
|
||||
summarizeBy: none
|
||||
sourceColumn: top_top_incre
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column rank1
|
||||
dataType: string
|
||||
lineageTag: 452adbd5-d507-4a2e-b323-9f60032e6e8e
|
||||
summarizeBy: none
|
||||
sourceColumn: rank1
|
||||
sortByColumn: rank_num
|
||||
|
||||
changedProperty = SortByColumn
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column prod_desc
|
||||
dataType: string
|
||||
lineageTag: 0b1185d8-6f40-40bd-8220-52d5c6ef4a0c
|
||||
summarizeBy: none
|
||||
sourceColumn: prod_desc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column type
|
||||
dataType: string
|
||||
lineageTag: bf3daec7-2aee-4f5e-b029-781d6ba67a48
|
||||
summarizeBy: none
|
||||
sourceColumn: type
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column cmps_desc
|
||||
dataType: string
|
||||
lineageTag: 844fb435-fc2b-43af-906c-d32ac9df27ec
|
||||
summarizeBy: none
|
||||
sourceColumn: cmps_desc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column brand
|
||||
dataType: string
|
||||
lineageTag: 971c8f8b-55d9-4654-a73e-bc7521fb1419
|
||||
summarizeBy: none
|
||||
sourceColumn: brand
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corp_desc
|
||||
dataType: string
|
||||
lineageTag: 1fe9b6f0-2a41-4744-b6ba-44cfa8536898
|
||||
summarizeBy: none
|
||||
sourceColumn: corp_desc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corp_cod
|
||||
dataType: string
|
||||
lineageTag: 7fdee000-e956-4898-b955-c7b8a4d9499c
|
||||
summarizeBy: none
|
||||
sourceColumn: corp_cod
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corporation
|
||||
dataType: string
|
||||
lineageTag: 291cebde-2b6b-4759-a911-65af3b1f2fbb
|
||||
summarizeBy: none
|
||||
sourceColumn: corporation
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_quarter
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: 8fbb709b-35f0-48af-ab2c-1eee4397b7e8
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_quarter
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_amount
|
||||
dataType: double
|
||||
lineageTag: 1e74e5c4-345d-4054-95fe-463f1d803ecf
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_amount
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column sales_amount_ly
|
||||
dataType: double
|
||||
lineageTag: e9ed2c01-dfff-41eb-93c1-82ec3a1f6d7e
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_amount_ly
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column rank_num
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: c6b72f4a-496f-4e78-bfa8-12a6db3c88c8
|
||||
summarizeBy: sum
|
||||
sourceColumn: rank_num
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
partition Fact_Direct_Retail_national_prd_rank = m
|
||||
mode: import
|
||||
queryGroup: Fact_Sales
|
||||
source = ```
|
||||
let
|
||||
Source =
|
||||
Value.NativeQuery(
|
||||
Databricks.Catalogs(
|
||||
ServerAddress, HttpPath, [
|
||||
Catalog = CatalogName,
|
||||
Database = null,
|
||||
EnableAutomaticProxyDiscovery = null,EnableQueryResultDownload="0"
|
||||
]
|
||||
){
|
||||
[Name = CatalogName, Kind = "Database"]
|
||||
}[Data],
|
||||
"
|
||||
-- *************************************
|
||||
-- 功能说明:零售全国数据季度同比分析
|
||||
-- 数据来源:dwd.dwd_gnd_retail_national_prd_rank
|
||||
-- 输出内容:当前季度 vs 去年同期的销售金额对比
|
||||
-- *************************************
|
||||
|
||||
WITH format_table AS (
|
||||
-- 步骤1:清洗并标准化字段,去除首尾空格
|
||||
SELECT
|
||||
TRIM(ta) AS ta,
|
||||
TRIM(rx_otc) AS rx_otc,
|
||||
TRIM(top_top_incre) AS top_top_incre,
|
||||
TRIM(rank1) AS rank1,
|
||||
TRIM(prod_desc) AS prod_desc,
|
||||
TRIM(type) AS type,
|
||||
TRIM(cmps_desc) AS cmps_desc,
|
||||
TRIM(brand) AS brand,
|
||||
TRIM(corp_desc) AS corp_desc,
|
||||
TRIM(corporation) AS corporation,
|
||||
TRIM(sales_quarter) AS sales_quarter,
|
||||
sales_amount
|
||||
FROM dwd.dwd_gnd_retail_national_prd_rank
|
||||
)
|
||||
|
||||
-- 步骤2:主查询,关联去年同期数据
|
||||
SELECT
|
||||
a.ta,
|
||||
a.rx_otc,
|
||||
a.top_top_incre,
|
||||
|
||||
-- rank1 字段处理:'total' 转为 99,其他转为整数类型
|
||||
CASE
|
||||
WHEN LOWER(a.rank1) = 'total' THEN 99
|
||||
ELSE CAST(a.rank1 AS INT)
|
||||
END AS rank_num,
|
||||
|
||||
a.rank1,
|
||||
a.prod_desc,
|
||||
a.type,
|
||||
a.cmps_desc,
|
||||
a.brand,
|
||||
-- d.iqvia_prod_code (暂时注释)
|
||||
a.corp_desc,
|
||||
|
||||
-- 关联企业编码
|
||||
c.corp_cod,
|
||||
a.corporation,
|
||||
|
||||
-- 销售季度转换:如 '2023Q1' → 202301
|
||||
CAST(
|
||||
CONCAT(
|
||||
SUBSTR(a.sales_quarter, 1, 4), -- 年份:2023
|
||||
LPAD(CAST(CAST(SUBSTR(a.sales_quarter, 6, 1) AS INT) * 3 AS STRING), 2, '0') -- 季度:Q1→03
|
||||
) AS INT
|
||||
) AS sales_quarter,
|
||||
|
||||
-- 销售金额单位转换(假设原始单位为百万,转为实际金额 * 1000000)
|
||||
CAST(a.sales_amount * 1000000 AS DECIMAL(20, 2)) AS sales_amount,
|
||||
|
||||
-- 去年同期销售金额
|
||||
CAST(b.sales_amount * 1000000 AS DECIMAL(20, 2)) AS sales_amount_ly
|
||||
|
||||
FROM format_table a
|
||||
|
||||
-- 自连接获取去年同期数据
|
||||
LEFT JOIN format_table b
|
||||
ON COALESCE(a.ta, '') = COALESCE(b.ta, '')
|
||||
AND COALESCE(a.rx_otc, '') = COALESCE(b.rx_otc, '')
|
||||
AND COALESCE(a.top_top_incre, '')= COALESCE(b.top_top_incre, '')
|
||||
AND COALESCE(a.rank1, '') = COALESCE(b.rank1, '')
|
||||
AND COALESCE(a.prod_desc, '') = COALESCE(b.prod_desc, '')
|
||||
AND COALESCE(a.type, '') = COALESCE(b.type, '')
|
||||
AND COALESCE(a.cmps_desc, '') = COALESCE(b.cmps_desc, '')
|
||||
AND COALESCE(a.brand, '') = COALESCE(b.brand, '')
|
||||
AND COALESCE(a.corp_desc, '') = COALESCE(b.corp_desc, '')
|
||||
AND COALESCE(a.corporation, '') = COALESCE(b.corporation, '')
|
||||
-- 季度匹配:当前季度年份 - 1,季度后缀不变
|
||||
AND CONCAT(CAST(CAST(SUBSTR(a.sales_quarter, 1, 4) AS INT) - 1 AS STRING), SUBSTR(a.sales_quarter, 5)) = b.sales_quarter
|
||||
|
||||
-- 关联企业编码映射表
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
ZK_Corp_C,
|
||||
MAX(CORP_COD) AS CORP_COD -- 一对多时取最大值,避免重复
|
||||
FROM dwd.dwd_inc_gnd_retail_b2c_label_total
|
||||
WHERE CORP_COD IS NOT NULL
|
||||
GROUP BY ZK_Corp_C
|
||||
) c
|
||||
ON a.corp_desc = c.zk_corp_c
|
||||
"
|
||||
& UsingLimit,
|
||||
null,
|
||||
[
|
||||
EnableFolding = true
|
||||
]
|
||||
)
|
||||
in
|
||||
Source
|
||||
```
|
||||
|
||||
annotation PBI_NavigationStepName = Navigation
|
||||
|
||||
annotation PBI_ResultType = Table
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
table Fact_Direct_Retail_region_corp_rank
|
||||
lineageTag: f61bc5b9-a3d7-4beb-91b5-34c3f55fc44c
|
||||
|
||||
column ta
|
||||
dataType: string
|
||||
lineageTag: d689b859-cc7a-4c9b-9b54-7ef9252ecf60
|
||||
summarizeBy: none
|
||||
sourceColumn: ta
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column rx_otc
|
||||
dataType: string
|
||||
lineageTag: f9f5b015-9b9b-4ec4-b237-9536a8fe0d0a
|
||||
summarizeBy: none
|
||||
sourceColumn: rx_otc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top_top_incre
|
||||
dataType: string
|
||||
lineageTag: 671d7409-d814-4c5e-8dd2-f0911fc0d0ad
|
||||
summarizeBy: none
|
||||
sourceColumn: top_top_incre
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column region
|
||||
dataType: string
|
||||
lineageTag: 475cbea5-e061-421a-8dea-6b1f825af5a7
|
||||
summarizeBy: none
|
||||
sourceColumn: region
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column rank1
|
||||
dataType: string
|
||||
lineageTag: 0aa2e2e8-8054-4f38-8c9b-8d8bea8f2f1a
|
||||
summarizeBy: none
|
||||
sourceColumn: rank1
|
||||
sortByColumn: rank_num
|
||||
|
||||
changedProperty = SortByColumn
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corp_desc
|
||||
dataType: string
|
||||
lineageTag: 10f18f48-99a8-4083-a1e7-8bf0d9ec4478
|
||||
summarizeBy: none
|
||||
sourceColumn: corp_desc
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corporation
|
||||
dataType: string
|
||||
lineageTag: 3bd924a0-8846-41f8-9845-80e29ecb1313
|
||||
summarizeBy: none
|
||||
sourceColumn: corporation
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column type
|
||||
dataType: string
|
||||
lineageTag: 616bca65-7041-4b73-bfa3-6c97a6342fbf
|
||||
summarizeBy: none
|
||||
sourceColumn: type
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_quarter
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: c8ca2077-1c51-4927-87fe-3392730cd991
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_quarter
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_amount
|
||||
dataType: double
|
||||
lineageTag: e26b6f73-4796-45fa-8a66-1e0499e70207
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_amount
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column rank_num
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: c1b1b35b-7e30-49f2-8359-fe68c9863ffc
|
||||
summarizeBy: sum
|
||||
sourceColumn: rank_num
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
partition Fact_Direct_Retail_region_corp_rank = m
|
||||
mode: import
|
||||
queryGroup: Fact_Sales
|
||||
source = ```
|
||||
let
|
||||
Source =
|
||||
Value.NativeQuery(
|
||||
Databricks.Catalogs(
|
||||
ServerAddress, HttpPath, [
|
||||
Catalog = CatalogName,
|
||||
Database = null,
|
||||
EnableAutomaticProxyDiscovery = null,EnableQueryResultDownload="0"
|
||||
]
|
||||
){
|
||||
[Name = CatalogName, Kind = "Database"]
|
||||
}[Data],
|
||||
"
|
||||
select
|
||||
a.ta
|
||||
,a.rx_otc
|
||||
,a.top_top_incre
|
||||
,a.region
|
||||
,a.rank1
|
||||
,COALESCE(cast(a.rank1 as int),99) as rank_num
|
||||
,a.corp_desc
|
||||
,a.corporation
|
||||
,a.type
|
||||
,CAST(
|
||||
CONCAT(
|
||||
SUBSTR(a.sales_quarter, 1, 4),
|
||||
LPAD(CAST(CAST(SUBSTR(a.sales_quarter, 6, 1) AS INT) * 3 AS STRING), 2, '0')
|
||||
) AS INT
|
||||
) AS sales_quarter
|
||||
,CAST(a.sales_amount * 1000000 AS DECIMAL(20, 2)) AS sales_amount
|
||||
from dwd.dwd_gnd_retail_region_corp_rank a
|
||||
"
|
||||
& UsingLimit,
|
||||
null,
|
||||
[
|
||||
EnableFolding = true
|
||||
]
|
||||
)
|
||||
in
|
||||
Source
|
||||
```
|
||||
|
||||
annotation PBI_NavigationStepName = Navigation
|
||||
|
||||
annotation PBI_ResultType = Table
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
table Fact_Direct_Retail_rx_market
|
||||
lineageTag: 5ce8ace0-0e58-4a5e-b8f7-6a83ec904179
|
||||
|
||||
column type_name
|
||||
dataType: string
|
||||
lineageTag: ff0f5e9c-73b4-4a77-8f4a-b623e033b468
|
||||
summarizeBy: none
|
||||
sourceColumn: type_name
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column type_name_key
|
||||
dataType: string
|
||||
lineageTag: 357fb16c-84ee-4a0f-ae54-933534096eae
|
||||
summarizeBy: none
|
||||
sourceColumn: type_name_key
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_month
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: 97530959-68fa-4b9e-b33d-2e25449543df
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_month
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_quarter
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: 47b8f7e8-00a1-4a2e-8e59-8a790e1255de
|
||||
summarizeBy: none
|
||||
sourceColumn: sales_quarter
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_amount
|
||||
dataType: double
|
||||
lineageTag: 424653b6-4a88-4863-b496-02243d81d8c0
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_amount
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column sales_amount_ly
|
||||
dataType: double
|
||||
lineageTag: af0e7e91-e45b-4c3a-a878-8279b807acca
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_amount_ly
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column is_overview_page
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: cf6555a1-44eb-4159-8f2a-1ae1269f1ad2
|
||||
summarizeBy: sum
|
||||
sourceColumn: is_overview_page
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
partition Fact_Direct_Retail_rx_market = m
|
||||
mode: import
|
||||
queryGroup: Fact_Sales
|
||||
source = ```
|
||||
let
|
||||
Source =
|
||||
Value.NativeQuery(
|
||||
Databricks.Catalogs(
|
||||
ServerAddress, HttpPath, [
|
||||
Catalog = CatalogName,
|
||||
Database = null,
|
||||
EnableAutomaticProxyDiscovery = null,EnableQueryResultDownload="0"
|
||||
]
|
||||
){
|
||||
[Name = CatalogName, Kind = "Database"]
|
||||
}[Data],
|
||||
"
|
||||
SELECT
|
||||
a.type_name,
|
||||
CASE
|
||||
WHEN a.type_name = 'AZ' THEN 'AZ'
|
||||
WHEN a.type_name = 'Rx' THEN 'TOTAL'
|
||||
WHEN a.type_name = 'Local' THEN 'LOCAL'
|
||||
WHEN a.type_name = 'MNC' THEN 'MNC'
|
||||
else null
|
||||
END AS type_name_key,
|
||||
CAST(a.sales_quarter AS INT) AS sales_month,
|
||||
CAST(
|
||||
CONCAT(
|
||||
SUBSTR(CAST(a.sales_quarter AS STRING), 1, 4),
|
||||
LPAD(CAST(CEIL(CAST(SUBSTR(CAST(a.sales_quarter AS STRING), 5, 2) AS INT) / 3.0) * 3 AS STRING), 2, '0')
|
||||
) AS INT
|
||||
) AS sales_quarter,
|
||||
CAST(a.sales_amount*1000000 AS DECIMAL(20, 2)) AS sales_amount,
|
||||
CAST(b.sales_amount*1000000 AS DECIMAL(20, 2)) AS sales_amount_ly -- 去年同期
|
||||
,case when a.type_name IN ('AZ', 'Rx', 'Local', 'MNC') then 1 else 0 end as is_overview_page
|
||||
FROM dwd.dwd_gnd_ext_retail_rx_market a
|
||||
LEFT JOIN dwd.dwd_gnd_ext_retail_rx_market b
|
||||
ON b.type_name = a.type_name
|
||||
AND CAST(b.sales_quarter AS INT) = CAST(a.sales_quarter AS INT) - 100 -- YYYYMM - 100 = 去年同月
|
||||
"
|
||||
& UsingLimit,
|
||||
null,
|
||||
[
|
||||
EnableFolding = true
|
||||
]
|
||||
)
|
||||
in
|
||||
Source
|
||||
```
|
||||
|
||||
annotation PBI_NavigationStepName = Navigation
|
||||
|
||||
annotation PBI_ResultType = Exception
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
table Fact_Direct_Retail_rx_top_corp
|
||||
lineageTag: fbf6f72a-cf36-4178-bba2-7c20331b90c9
|
||||
|
||||
column corporation
|
||||
dataType: string
|
||||
lineageTag: 8561f456-7563-4453-8023-af6ef9caa819
|
||||
summarizeBy: none
|
||||
sourceColumn: corporation
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column quarter_flag
|
||||
dataType: string
|
||||
lineageTag: 26045c57-a4e1-492d-bd0c-9729725a3b74
|
||||
summarizeBy: none
|
||||
sourceColumn: quarter_flag
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top1_brand_val
|
||||
dataType: string
|
||||
lineageTag: dc79413f-ce11-415a-bed4-d3f35701da74
|
||||
summarizeBy: none
|
||||
sourceColumn: top1_brand_val
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top1_brand_gr
|
||||
dataType: double
|
||||
formatString: 0.00%;-0.00%;0.00%
|
||||
lineageTag: fb7c4e0e-de2e-49d3-a90d-f0ae2321e2f5
|
||||
summarizeBy: sum
|
||||
sourceColumn: top1_brand_gr
|
||||
|
||||
changedProperty = DataType
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top2_brand_val
|
||||
dataType: string
|
||||
lineageTag: a7512f4b-a95b-4400-9f96-7ad3adadea14
|
||||
summarizeBy: none
|
||||
sourceColumn: top2_brand_val
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top2_brand_gr
|
||||
dataType: double
|
||||
formatString: #,##0.00 %
|
||||
lineageTag: 6b87d8ab-210e-4732-84c5-be2d69343043
|
||||
summarizeBy: sum
|
||||
sourceColumn: top2_brand_gr
|
||||
|
||||
changedProperty = DataType
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column top1_incremental_brand
|
||||
dataType: string
|
||||
lineageTag: d648d1a7-2111-4f2e-93a6-aa1b3286f1da
|
||||
summarizeBy: none
|
||||
sourceColumn: top1_incremental_brand
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top1_incremental_gr
|
||||
dataType: double
|
||||
formatString: 0.00%;-0.00%;0.00%
|
||||
lineageTag: 728c8d18-cdd7-4652-b373-6961bc5472bf
|
||||
summarizeBy: sum
|
||||
sourceColumn: top1_incremental_gr
|
||||
|
||||
changedProperty = DataType
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top2_incremental_brand
|
||||
dataType: string
|
||||
lineageTag: 90aa05a6-1396-4467-8e63-b99e16e56e58
|
||||
summarizeBy: none
|
||||
sourceColumn: top2_incremental_brand
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top2_incremental_gr
|
||||
dataType: double
|
||||
formatString: 0.00%;-0.00%;0.00%
|
||||
lineageTag: 4cc8a03c-0732-4234-ac9a-5b89c555e940
|
||||
summarizeBy: sum
|
||||
sourceColumn: top2_incremental_gr
|
||||
|
||||
changedProperty = DataType
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top1_brand_val_en
|
||||
dataType: string
|
||||
lineageTag: e799a95a-5ccc-4ad8-a9b5-88f0752ca127
|
||||
summarizeBy: none
|
||||
sourceColumn: top1_brand_val_en
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top2_brand_val_en
|
||||
dataType: string
|
||||
lineageTag: f110c3d7-9b07-4c56-8c49-c7fe3d6c717b
|
||||
summarizeBy: none
|
||||
sourceColumn: top2_brand_val_en
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top1_incremental_brand_en
|
||||
dataType: string
|
||||
lineageTag: f82873ae-d4bf-4a77-acb6-0813e992be1b
|
||||
summarizeBy: none
|
||||
sourceColumn: top1_incremental_brand_en
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column top2_incremental_brand_en
|
||||
dataType: string
|
||||
lineageTag: a12a1646-e70a-4ea1-a387-346b2b9e4609
|
||||
summarizeBy: none
|
||||
sourceColumn: top2_incremental_brand_en
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column corp_cod
|
||||
dataType: string
|
||||
lineageTag: 5cee87f6-a22b-489f-8f73-ad9a69068c81
|
||||
summarizeBy: none
|
||||
sourceColumn: corp_cod
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column yyyymm
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
lineageTag: 32abc77e-b874-4dc9-a370-13deeb2157aa
|
||||
summarizeBy: none
|
||||
sourceColumn: yyyymm
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
partition Fact_Direct_Retail_rx_top_corp = m
|
||||
mode: import
|
||||
queryGroup: Fact_Sales
|
||||
source = ```
|
||||
let
|
||||
Source =
|
||||
Value.NativeQuery(
|
||||
Databricks.Catalogs(
|
||||
ServerAddress, HttpPath, [
|
||||
Catalog = CatalogName,
|
||||
Database = null,
|
||||
EnableAutomaticProxyDiscovery = null,EnableQueryResultDownload="0"
|
||||
]
|
||||
){
|
||||
[Name = CatalogName, Kind = "Database"]
|
||||
}[Data],
|
||||
"
|
||||
with packinfo (
|
||||
select
|
||||
PROD_DESC_C,
|
||||
max(PROD_DESC) PROD_DESC
|
||||
from
|
||||
dm.dm_td_ext_retail_pack_property
|
||||
where
|
||||
PROD_DESC is not null
|
||||
group by
|
||||
PROD_DESC_C
|
||||
)
|
||||
select
|
||||
a.corporation
|
||||
,a.quarter_flag
|
||||
,a.top1_brand_val
|
||||
,d.prod_desc as top1_brand_val_en
|
||||
,a.top1_brand_gr
|
||||
,a.top2_brand_val
|
||||
,d.prod_desc as top2_brand_val_en
|
||||
,a.top2_brand_gr
|
||||
,a.top1_incremental_brand
|
||||
,d.prod_desc as top1_incremental_brand_en
|
||||
,a.top1_incremental_gr
|
||||
,a.top2_incremental_brand
|
||||
,d.prod_desc as top2_incremental_brand_en
|
||||
,a.top2_incremental_gr
|
||||
,c.corp_cod
|
||||
,cast(concat('20',right(a.quarter_flag,4)) as int) as yyyymm
|
||||
from dwd.dwd_gnd_ext_retail_rx_top_corp a
|
||||
LEFT JOIN
|
||||
(SELECT ZK_Corp,min(CORP_COD) CORP_COD
|
||||
FROM dwd.dwd_inc_gnd_retail_b2c_label_total
|
||||
WHERE CORP_COD is NOT NULL GROUP BY ZK_Corp) c
|
||||
on a.corporation = c.ZK_Corp
|
||||
left join packinfo d on a.top1_brand_val = d.prod_desc_c
|
||||
left join packinfo e on a.top1_brand_val = e.prod_desc_c
|
||||
left join packinfo f on a.top1_brand_val = f.prod_desc_c
|
||||
left join packinfo g on a.top1_brand_val = g.prod_desc_c
|
||||
"
|
||||
& UsingLimit,
|
||||
null,
|
||||
[
|
||||
EnableFolding = true
|
||||
]
|
||||
)
|
||||
in
|
||||
Source
|
||||
```
|
||||
|
||||
annotation PBI_NavigationStepName = Navigation
|
||||
|
||||
annotation PBI_ResultType = Table
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
table Fact_Retail_Special
|
||||
lineageTag: 03270d86-cd05-4e82-8d9b-3c07a61ae07d
|
||||
|
||||
column market
|
||||
dataType: string
|
||||
lineageTag: 211934fd-fc53-4f05-9e64-a6f76b1f3a92
|
||||
summarizeBy: none
|
||||
sourceColumn: market
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column province_city
|
||||
dataType: string
|
||||
lineageTag: eddc6fc4-9197-4ddb-89e6-caa5c30ccfca
|
||||
summarizeBy: none
|
||||
sourceColumn: province_city
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column audit_key
|
||||
dataType: string
|
||||
lineageTag: 1b0c5594-91ae-4c6d-9dc5-af16099da672
|
||||
summarizeBy: none
|
||||
sourceColumn: audit_key
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column yyyymm
|
||||
dataType: string
|
||||
lineageTag: badbdb34-9b05-4c44-b865-738549ab9d64
|
||||
summarizeBy: none
|
||||
sourceColumn: yyyymm
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column sales_value
|
||||
dataType: double
|
||||
lineageTag: f02a1e51-8f8d-46e8-a145-f75b5be718af
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_value
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column sales_volume
|
||||
dataType: double
|
||||
lineageTag: 9266f441-b1f7-47e0-825c-eb594ab31e99
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_volume
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column pdot_counting_unit
|
||||
dataType: double
|
||||
lineageTag: a5affad6-965f-4513-a231-a8285fdf40ed
|
||||
summarizeBy: sum
|
||||
sourceColumn: pdot_counting_unit
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column audit_source
|
||||
dataType: string
|
||||
lineageTag: b46c7620-5dcf-4c87-906f-327a8b0d2170
|
||||
summarizeBy: none
|
||||
sourceColumn: audit_source
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column date_key
|
||||
dataType: dateTime
|
||||
formatString: Long Date
|
||||
lineageTag: ce7abf1b-9099-41b3-bd06-af96c983648c
|
||||
summarizeBy: none
|
||||
sourceColumn: date_key
|
||||
|
||||
changedProperty = DataType
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation UnderlyingDateTimeDataType = Date
|
||||
|
||||
column sales_value_ly
|
||||
dataType: double
|
||||
lineageTag: 4a689421-1ba3-4557-8830-3e3fc15d3b62
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_value_ly
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column sales_volume_ly
|
||||
dataType: double
|
||||
lineageTag: e1622402-5a58-4798-812a-226e529a8f41
|
||||
summarizeBy: sum
|
||||
sourceColumn: sales_volume_ly
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column pdot_counting_unit_ly
|
||||
dataType: double
|
||||
lineageTag: 0e63434c-ada9-43e7-974d-d5415e5dc395
|
||||
summarizeBy: sum
|
||||
sourceColumn: pdot_counting_unit_ly
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
annotation PBI_FormatHint = {"isGeneralNumber":true}
|
||||
|
||||
column rc_key
|
||||
dataType: string
|
||||
lineageTag: 52bdfe70-0b61-43b6-879d-edca0767cc39
|
||||
summarizeBy: none
|
||||
sourceColumn: rc_key
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
partition Fact_Retail_Special = m
|
||||
mode: import
|
||||
queryGroup: OLD\FreeReport独有表
|
||||
source = ```
|
||||
let
|
||||
Source =
|
||||
Value.NativeQuery(
|
||||
Databricks.Catalogs(
|
||||
ServerAddress, HttpPath, [
|
||||
Catalog = CatalogName,
|
||||
Database = null,
|
||||
EnableAutomaticProxyDiscovery = null,EnableQueryResultDownload="0"
|
||||
]
|
||||
){
|
||||
[Name = CatalogName, Kind = "Database"]
|
||||
}[Data],
|
||||
"
|
||||
select
|
||||
a.market
|
||||
,a.province_city
|
||||
,a.audit_key
|
||||
,a.audit_source
|
||||
,a.date_key
|
||||
,a.yyyymm
|
||||
,a.sales_value
|
||||
,a.sales_volume
|
||||
,a.pdot_counting_unit
|
||||
,a.sales_value_ly
|
||||
,a.sales_volume_ly
|
||||
,a.pdot_counting_unit_ly
|
||||
,concat(a.audit_source,a.market) rc_key
|
||||
from dm.dm_tf_external_retail_special a
|
||||
"
|
||||
& UsingLimit,
|
||||
null,
|
||||
[
|
||||
EnableFolding = true
|
||||
]
|
||||
)
|
||||
in
|
||||
Source
|
||||
```
|
||||
|
||||
annotation PBI_NavigationStepName = Navigation
|
||||
|
||||
annotation PBI_ResultType = Table
|
||||
|
||||
annotation TabularEditor_TableGroup = 05_FactTable
|
||||
|
||||
@@ -366,12 +366,11 @@ table Fact_Sales
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
column EGFR_FLAG
|
||||
dataType: int64
|
||||
formatString: 0
|
||||
column TARGET_INS
|
||||
dataType: string
|
||||
lineageTag: 43b1127c-5c48-406b-ab40-0c472b7b1677
|
||||
summarizeBy: sum
|
||||
sourceColumn: EGFR_FLAG
|
||||
summarizeBy: none
|
||||
sourceColumn: TARGET_INS
|
||||
|
||||
annotation SummarizationSetBy = Automatic
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ table Fact_Sales_Total
|
||||
SUM(NULLIF(A.PDOT, 0)) AS PDOT,
|
||||
SUM(NULLIF(A.PDOT_LY, 0)) AS PDOT_LY
|
||||
FROM
|
||||
DM.dm_tf_ext_unionall_market_sales A
|
||||
DM.dm_tf_ext_unionall_sales_mapping A
|
||||
WHERE
|
||||
YYYYMM >= (YEAR(CURRENT_DATE()) - 3) * 100 + 1 -- 内联,消除 CROSS JOIN
|
||||
AND DATA_SOURCE <> 'XH Data(Quarterly)'
|
||||
@@ -238,7 +238,7 @@ table Fact_Sales_Total
|
||||
Source
|
||||
```
|
||||
|
||||
annotation PBI_ResultType = Exception
|
||||
annotation PBI_ResultType = Table
|
||||
|
||||
annotation PBI_NavigationStepName = Navigation
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user