20260428
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
"tabOrder": [
|
||||
"Query 1",
|
||||
"Query 2",
|
||||
"Query 3"
|
||||
"Query 3",
|
||||
"Query 4"
|
||||
],
|
||||
"defaultTab": "Query 3"
|
||||
"defaultTab": "Query 4"
|
||||
}
|
||||
20
External All Channel.SemanticModel/DAXQueries/Query 4.dax
Normal file
20
External All Channel.SemanticModel/DAXQueries/Query 4.dax
Normal file
@@ -0,0 +1,20 @@
|
||||
DEFINE
|
||||
FUNCTION Switch_Unit_Value = (unit, O_Value) =>
|
||||
SWITCH(
|
||||
unit,
|
||||
"RMB", O_Value,
|
||||
"K RMB", O_Value / 1000,
|
||||
"M RMB", O_Value / 1000000,
|
||||
"USD", DIVIDE(
|
||||
O_Value,
|
||||
[ExchangeRate]
|
||||
),
|
||||
"K USD", DIVIDE(
|
||||
O_Value,
|
||||
[ExchangeRate]
|
||||
) / 1000,
|
||||
"M USD", DIVIDE(
|
||||
O_Value,
|
||||
[ExchangeRate]
|
||||
) / 1000000
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
22
External All Channel.SemanticModel/definition/functions.tmdl
Normal file
22
External All Channel.SemanticModel/definition/functions.tmdl
Normal file
@@ -0,0 +1,22 @@
|
||||
function Switch_Unit_Value =
|
||||
(unit, O_Value) =>
|
||||
SWITCH(
|
||||
unit,
|
||||
"RMB", O_Value,
|
||||
"K RMB", O_Value / 1000,
|
||||
"M RMB", O_Value / 1000000,
|
||||
"USD", DIVIDE(
|
||||
O_Value,
|
||||
[ExchangeRate]
|
||||
),
|
||||
"K USD", DIVIDE(
|
||||
O_Value,
|
||||
[ExchangeRate]
|
||||
) / 1000,
|
||||
"M USD", DIVIDE(
|
||||
O_Value,
|
||||
[ExchangeRate]
|
||||
) / 1000000
|
||||
)
|
||||
lineageTag: 13dbea01-c9ee-4b9f-8d71-1d24e20fd595
|
||||
|
||||
@@ -66,7 +66,7 @@ queryGroup Dim
|
||||
|
||||
annotation __PBI_TimeIntelligenceEnabled = 0
|
||||
|
||||
annotation PBI_QueryOrder = ["Measure THC","Dim_PackInfo_Retail","Dim_MergeDataSource","Fact_Retail_Brand","Fact_Retail_RawData","Fact_EC_Total","Fact_Retail","Config_ReportURL","refresh_time","Dim_BrandMKT","Dim_Market_Total","Dim_MarketTA_Total","Dim_BrandDefaultMKT","Dim_Calendar","Dim_Corp","Dim_DataSource","Dim_Geo","Dim_PlatformMID","Dim_StoreTypeMID","Dim_GeoGroup","Dim_Market","Dim_MarketTA","Dim_Org","Dim_PackInfo","Dim_Platform","Dim_StoreType","Dim_ExchangRate","DM_AUTH_ORG","DM_AUTH_PRD","DM_AUTH_SALES_GEO","DM_AUTH_SALES_MKT","DM_AUTH_SALES_PACK","DM_AUTH_SALES_ORG","DM_AUTH_GEO","HttpPath","CatalogName","ServerAddress","limit_validity","UsingLimit","limit","TOP","Dim_PackInfo_Total","Dim_RegionType","Fact_Sales_SQL","Fact_Sales_SQL_limit","Fact_Sales_Total","Dim_Unit","dm_td_chpa_market_definition","Fact_Retail_Total","Fact_Sales_Total_AIA","Fact_EC","Dim_Class","Dim_HPFlag","Dim_HPFlag_AIASpecial","Dim_InsSalesType","Dim_InsSalesType_AIASpecial","Dim_IsTarget_AIASpecial","Dim_CoreDept","Dim_Dept","Dim_PrescriptionSource","Dim_Reimburse","Dim_ReimburseType","dm_auth_aia_sales_pack","dm_auth_aia_sales_geo","dm_auth_aia_sales_org","dm_auth_aia_sales_mkt","DM_AIA_TD_HOSPITAL_NOT_PROVIDED","Dim_Original_Col_AIA","Dim_HP_Potential_AIA","AIA.Measures","DM_AUTH_PRD_PACK","Fact_Retail_Special","AIA_AdvanceAnalysis_Brand","AIA_AdvanceAnalysis_Class","AIA_AdvanceAnalysis_Key_Competitor","AIA_AdvanceAnalysis_Mole","AIA_AdvanceAnalysis_Subchannel","AIA_AdvanceAnalysis_DRAGON","AIA_AdvanceAnalysis_Decile","AIA_AdvanceAnalysis_Decile_Group","Dim_IsEagle_AIASpecial","Dim_IsEagle_Bridge_AIASpecial","Dim_RC","Dim_Institution","DM_AUTH_SALES_TA","DM_AUTH_NONSALES_TA","DM_AUTH_MERGED_DATA","DM_AUTH_NONSALES_ORG","dm_td_user_permission_detail","Config_MarketRatio","Config_MergeData","Dim_RC_Merged_Data","Fact_AIA_DataQuality","DM_AUTH_EMAIL_NOTIFICATION","Config_EmailWarning","Dim_Remove_inst","Config_PageFlag_FreeReportNIAD","Config_VisualFlag","Fact_Sales_THC","Fact_Sales_NIAD","00_KPI","Dim_KeyCompetitor","Dim_Store","Dim_HP_Level"]
|
||||
annotation PBI_QueryOrder = ["Measure THC","Dim_PackInfo_Retail","Dim_MergeDataSource","Fact_Retail_Brand","Fact_Retail_RawData","Fact_EC_Total","Fact_Retail","Config_ReportURL","refresh_time","Dim_BrandMKT","Dim_Market_Total","Dim_MarketTA_Total","Dim_BrandDefaultMKT","Dim_Calendar","Dim_Corp","Dim_DataSource","Dim_Geo","Dim_PlatformMID","Dim_StoreTypeMID","Dim_GeoGroup","Dim_Market","Dim_MarketTA","Dim_Org","Dim_PackInfo","Dim_Platform","Dim_StoreType","Dim_ExchangRate","DM_AUTH_ORG","DM_AUTH_PRD","DM_AUTH_SALES_GEO","DM_AUTH_SALES_MKT","DM_AUTH_SALES_PACK","DM_AUTH_SALES_ORG","DM_AUTH_GEO","HttpPath","CatalogName","ServerAddress","limit_validity","UsingLimit","limit","TOP","Dim_PackInfo_Total","Dim_RegionType","Fact_Sales_SQL","Fact_Sales_SQL_limit","Fact_Sales_Total","Dim_Unit","dm_td_chpa_market_definition","Fact_Retail_Total","Fact_Sales_Total_AIA","Fact_EC","Dim_Class","Dim_HPFlag","Dim_HPFlag_AIASpecial","Dim_InsSalesType","Dim_InsSalesType_AIASpecial","Dim_IsTarget_AIASpecial","Dim_CoreDept","Dim_Dept","Dim_PrescriptionSource","Dim_Reimburse","Dim_ReimburseType","dm_auth_aia_sales_pack","dm_auth_aia_sales_geo","dm_auth_aia_sales_org","dm_auth_aia_sales_mkt","DM_AIA_TD_HOSPITAL_NOT_PROVIDED","Dim_Original_Col_AIA","Dim_HP_Potential_AIA","AIA.Measures","DM_AUTH_PRD_PACK","AIA_AdvanceAnalysis_Brand","AIA_AdvanceAnalysis_Class","AIA_AdvanceAnalysis_Key_Competitor","AIA_AdvanceAnalysis_Mole","AIA_AdvanceAnalysis_Subchannel","AIA_AdvanceAnalysis_DRAGON","AIA_AdvanceAnalysis_Decile","AIA_AdvanceAnalysis_Decile_Group","Dim_IsEagle_AIASpecial","Dim_IsEagle_Bridge_AIASpecial","Dim_RC","Dim_Institution","DM_AUTH_SALES_TA","DM_AUTH_NONSALES_TA","DM_AUTH_MERGED_DATA","DM_AUTH_NONSALES_ORG","dm_td_user_permission_detail","Config_MarketRatio","Config_MergeData","Dim_RC_Merged_Data","Fact_AIA_DataQuality","DM_AUTH_EMAIL_NOTIFICATION","Config_EmailWarning","Dim_Remove_inst","Config_PageFlag_FreeReportNIAD","Config_VisualFlag","Fact_Sales_THC","Fact_Sales_NIAD","00_KPI","Dim_KeyCompetitor","Dim_Store","Dim_HP_Level","Fact_Direct_Retail_rx_market","Fact_Direct_Retail_rx_top_corp","Fact_Direct_Retail_national_corp_rank","Fact_Direct_Retail_national_prd_rank","Fact_Direct_Retail_region_corp_rank"]
|
||||
|
||||
annotation __TEdtr = 1
|
||||
|
||||
@@ -205,7 +205,6 @@ ref table dm_td_user_permission_detail
|
||||
ref table 'Fields_CrossChannel5.2'
|
||||
ref table Dim_DataSource_ForRLS
|
||||
ref table Retail_Price_MQ_Fields
|
||||
ref table Fact_Retail_Special
|
||||
ref table Fields_TopPlayer_EN
|
||||
ref table Fields_Leader_EN
|
||||
ref table AIA_Calgroup
|
||||
@@ -235,6 +234,11 @@ ref table Dim_KeyCompetitor
|
||||
ref table 0_Measure_CalGroup
|
||||
ref table Dim_Store
|
||||
ref table Dim_HP_Level
|
||||
ref table Fact_Direct_Retail_rx_market
|
||||
ref table Fact_Direct_Retail_national_corp_rank
|
||||
ref table Fact_Direct_Retail_national_prd_rank
|
||||
ref table Fact_Direct_Retail_rx_top_corp
|
||||
ref table Fact_Direct_Retail_region_corp_rank
|
||||
|
||||
ref role PI_BISO
|
||||
ref role PI_ADMIN
|
||||
|
||||
@@ -288,25 +288,12 @@ relationship 2724b646-60c1-d1d3-0343-6ffbe6c685cb
|
||||
fromColumn: Fact_Retail_RawData.DATA_SOURCE
|
||||
toColumn: Dim_DataSource_ForRLS.DATA_SOURCE
|
||||
|
||||
relationship 1375fbc8-d685-530f-2d1e-434050110dee
|
||||
fromColumn: Fact_Retail_Special.audit_key
|
||||
toColumn: Dim_Geo.AUDIT_KEY
|
||||
|
||||
relationship a488d2d3-f82f-406d-5c4d-ac5fd735ebe3
|
||||
fromColumn: Fact_Retail_Special.date_key
|
||||
toColumn: Dim_Calendar.DATE
|
||||
|
||||
relationship 73477bd1-8615-2d4f-4a3d-99b57f53e812
|
||||
isActive: false
|
||||
toCardinality: many
|
||||
fromColumn: Dim_BrandMKT.IS_HIDDEN_COUNTY
|
||||
toColumn: Dim_RegionType.IS_HIDDEN_COUNTY
|
||||
|
||||
relationship 8f295e0b-4761-0abb-e005-51d8d5d2448f
|
||||
toCardinality: many
|
||||
fromColumn: Fact_Retail_Special.rc_key
|
||||
toColumn: Dim_RC.rc_key
|
||||
|
||||
relationship e369a4e6-11ea-c7ed-9f2d-ea5ed1f6316b
|
||||
crossFilteringBehavior: bothDirections
|
||||
fromColumn: Dim_RC_Merged_Data.KEY
|
||||
@@ -492,3 +479,15 @@ relationship f45c709b-4d1a-81fa-f81d-6079626c9a54
|
||||
fromColumn: Fact_Sales_NIAD.STORE_TYPE_KEY
|
||||
toColumn: Dim_StoreTypeMID.STORE_TYPE_SOURCE
|
||||
|
||||
relationship bb8ae86a-58a8-52d8-7a4f-5737b1146f77
|
||||
fromColumn: Fact_Direct_Retail_rx_market.sales_quarter
|
||||
toColumn: Dim_Calendar.YYYYMM
|
||||
|
||||
relationship d28149d7-9463-b4de-ea4c-81085f1c513b
|
||||
fromColumn: Fact_Direct_Retail_national_corp_rank.sales_quarter_num
|
||||
toColumn: Dim_Calendar.YYYYMM
|
||||
|
||||
relationship bb7d7eaf-bd77-e1d1-7c11-3c7b00ecdbef
|
||||
fromColumn: Fact_Direct_Retail_rx_top_corp.yyyymm
|
||||
toColumn: Dim_Calendar.YYYYMM
|
||||
|
||||
|
||||
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
@@ -1363,8 +1363,8 @@
|
||||
{
|
||||
"ordinal": 3,
|
||||
"scrollPosition": {
|
||||
"x": 108.20000076293945,
|
||||
"y": 320.20001220703125
|
||||
"x": 0,
|
||||
"y": 100
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
@@ -1534,8 +1534,8 @@
|
||||
{
|
||||
"ordinal": 4,
|
||||
"scrollPosition": {
|
||||
"x": 262.39999389648438,
|
||||
"y": 424.79998779296875
|
||||
"x": 0,
|
||||
"y": 149
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
@@ -1562,7 +1562,7 @@
|
||||
"height": 176,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 1
|
||||
"zIndex": 2
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
@@ -1575,7 +1575,7 @@
|
||||
"height": 300,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 2
|
||||
"zIndex": 3
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
@@ -1592,8 +1592,8 @@
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 386.22672016061972,
|
||||
"y": 718.40153282721394
|
||||
"x": 378.22672016061972,
|
||||
"y": 812.40153282721394
|
||||
},
|
||||
"nodeIndex": "Dim_StoreTypeMID",
|
||||
"nodeLineageTag": "d6ca2686-554d-4d78-a475-7787f1325ec0",
|
||||
@@ -1601,25 +1601,25 @@
|
||||
"height": 152,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 3
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 134.36502478014194,
|
||||
"y": 514.2563920221728
|
||||
},
|
||||
"nodeIndex": "Dim_PlatformMID",
|
||||
"nodeLineageTag": "1cd2fd49-62d1-49ca-ac98-218be929baae",
|
||||
"size": {
|
||||
"height": 152,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 4
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 50,
|
||||
"y": 310.29737465129062
|
||||
"x": 53.365024780141937,
|
||||
"y": 600.2563920221728
|
||||
},
|
||||
"nodeIndex": "Dim_PlatformMID",
|
||||
"nodeLineageTag": "1cd2fd49-62d1-49ca-ac98-218be929baae",
|
||||
"size": {
|
||||
"height": 152,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 5
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 17,
|
||||
"y": 1023.2973746512906
|
||||
},
|
||||
"nodeIndex": "Dim_RegionType",
|
||||
"nodeLineageTag": "6aa1d3be-7da3-480d-96ed-18f4d5839bbe",
|
||||
@@ -1627,7 +1627,7 @@
|
||||
"height": 152,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 5
|
||||
"zIndex": 12
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
@@ -1692,7 +1692,7 @@
|
||||
"height": 300,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 12
|
||||
"zIndex": 13
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
@@ -1705,7 +1705,7 @@
|
||||
"height": 248,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 0
|
||||
"zIndex": 1
|
||||
}
|
||||
],
|
||||
"name": "Fact_Sales_Total",
|
||||
@@ -1718,43 +1718,30 @@
|
||||
{
|
||||
"ordinal": 5,
|
||||
"scrollPosition": {
|
||||
"x": 0,
|
||||
"y": 329
|
||||
"x": 229.60000610351563,
|
||||
"y": 0
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"location": {
|
||||
"x": 848.40442164893818,
|
||||
"y": 941.1040159587094
|
||||
"x": 784,
|
||||
"y": 281
|
||||
},
|
||||
"nodeIndex": "Dim_Market",
|
||||
"nodeLineageTag": "e93174e2-bfca-4d29-bee7-23d72512e194",
|
||||
"nodeIndex": "Fact_Direct_Retail_rx_market",
|
||||
"nodeLineageTag": "5ce8ace0-0e58-4a5e-b8f7-6a83ec904179",
|
||||
"size": {
|
||||
"height": 296,
|
||||
"width": 234
|
||||
"height": 272,
|
||||
"width": 311
|
||||
},
|
||||
"zIndex": 2
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 50,
|
||||
"y": -50
|
||||
"x": 1355,
|
||||
"y": 224
|
||||
},
|
||||
"nodeIndex": "Fact_Sales_Total_AIA",
|
||||
"nodeLineageTag": "66e3af3d-7196-48cf-bbbf-64e7dcd68fd8",
|
||||
"size": {
|
||||
"height": 300,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 3
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 466.78249681720126,
|
||||
"y": 51.654010372800485
|
||||
},
|
||||
"nodeIndex": "Dim_PackInfo",
|
||||
"nodeLineageTag": "f420be02-8dc1-467f-8e0e-a8231e8b72e6",
|
||||
"nodeIndex": "Dim_Calendar",
|
||||
"nodeLineageTag": "b54e7974-59f5-4b19-b987-f439b32f640d",
|
||||
"size": {
|
||||
"height": 300,
|
||||
"width": 234
|
||||
@@ -1763,117 +1750,65 @@
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 179.83139682408921,
|
||||
"y": 303.7075487176154
|
||||
"x": 151,
|
||||
"y": 363
|
||||
},
|
||||
"nodeIndex": "Dim_Calendar",
|
||||
"nodeLineageTag": "b54e7974-59f5-4b19-b987-f439b32f640d",
|
||||
"nodeIndex": "Dim_CorpType",
|
||||
"nodeLineageTag": "765d61e6-451d-4b8e-8c67-4e7014f90b2a",
|
||||
"size": {
|
||||
"height": 128,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 1
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 654,
|
||||
"y": 633
|
||||
},
|
||||
"nodeIndex": "Fact_Direct_Retail_national_corp_rank",
|
||||
"nodeLineageTag": "40ba891d-21b7-4ded-ac27-2847d846b960",
|
||||
"size": {
|
||||
"height": 300,
|
||||
"width": 427
|
||||
},
|
||||
"zIndex": 3
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 179,
|
||||
"y": 728
|
||||
},
|
||||
"nodeIndex": "Dim_Corp",
|
||||
"nodeLineageTag": "188bce16-d07d-4b39-946b-b744c9a78bf3",
|
||||
"size": {
|
||||
"height": 200,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 5
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 1422.5341053415314,
|
||||
"y": 877.91301490724027
|
||||
"x": 427.20000076293945,
|
||||
"y": 155
|
||||
},
|
||||
"nodeIndex": "Dim_InsSalesType_AIASpecial",
|
||||
"nodeLineageTag": "e87a2aeb-7176-416d-82c6-8af2c15345ab",
|
||||
"size": {
|
||||
"height": 176,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 6
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 1135.4403075307409,
|
||||
"y": 745.55437675002474
|
||||
},
|
||||
"nodeIndex": "Dim_InsSalesType",
|
||||
"nodeLineageTag": "a283b30f-6bf9-4841-8c06-8b4b27572f51",
|
||||
"size": {
|
||||
"height": 200,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 9
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 1422.5235789797198,
|
||||
"y": 577.09547945074644
|
||||
},
|
||||
"nodeIndex": "Dim_InsSalesTypeKey_AIA",
|
||||
"nodeLineageTag": "027aa92b-8b0a-46e6-97fd-799f5a3396cc",
|
||||
"size": {
|
||||
"height": 200,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 7
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 753.25658465218567,
|
||||
"y": 340.65589965453603
|
||||
},
|
||||
"nodeIndex": "Fact_Sales_THC",
|
||||
"nodeLineageTag": "dd276b39-96c0-46dd-878f-9f1f23dbeb5c",
|
||||
"nodeIndex": "Fact_Direct_Retail_rx_top_corp",
|
||||
"nodeLineageTag": "fbf6f72a-cf36-4178-bba2-7c20331b90c9",
|
||||
"size": {
|
||||
"height": 300,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 8
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 492.56123070175306,
|
||||
"y": 694.310347125082
|
||||
},
|
||||
"nodeIndex": "Fact_Sales",
|
||||
"nodeLineageTag": "c6bdcb23-6f0c-4bd2-98b6-b3fd012d5ba6",
|
||||
"size": {
|
||||
"height": 300,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 10
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 561.04181342746517,
|
||||
"y": 1222.2199404277803
|
||||
},
|
||||
"nodeIndex": "AIA_AdvanceAnalysis_Key_Competitor",
|
||||
"nodeLineageTag": "9122e4fc-9030-4888-b909-269a57eefa95",
|
||||
"size": {
|
||||
"height": 128,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 11
|
||||
},
|
||||
{
|
||||
"location": {
|
||||
"x": 274.89046363992907,
|
||||
"y": 1047.2096172088673
|
||||
},
|
||||
"nodeIndex": "Dim_KeyCompetitor",
|
||||
"nodeLineageTag": "a6eb142e-da93-4631-939c-d1305beec9f0",
|
||||
"size": {
|
||||
"height": 128,
|
||||
"width": 234
|
||||
},
|
||||
"zIndex": 1
|
||||
"zIndex": 0
|
||||
}
|
||||
],
|
||||
"name": "Layout 2",
|
||||
"name": "Layout 1",
|
||||
"zoomValue": 100,
|
||||
"pinKeyFieldsToTop": true,
|
||||
"pinKeyFieldsToTop": false,
|
||||
"showExtraHeaderInfo": false,
|
||||
"hideKeyFieldsWhenCollapsed": false,
|
||||
"tablesLocked": false
|
||||
}
|
||||
],
|
||||
"selectedDiagram": "Fact_Sales_NIAD",
|
||||
"selectedDiagram": "Layout 1",
|
||||
"defaultDiagram": "All tables"
|
||||
}
|
||||
Reference in New Issue
Block a user