142 lines
6.5 KiB
Plaintext
142 lines
6.5 KiB
Plaintext
table AIA_Merge_Data
|
|
lineageTag: 707667ad-59ab-4dcd-b72c-c8b7f04c3e2c
|
|
|
|
calculationGroup
|
|
precedence: 8
|
|
|
|
calculationItem AIA_MergeData_WithBlank = IF( NOT ( ISFILTERED(Dim_Market[MARKET]) || ISFILTERED( Dim_BrandDefaultMKT[MARKET])), BLANK(),SELECTEDMEASURE())
|
|
|
|
calculationItem AIA_MERGE_DATA_5_2 =
|
|
VAR _isfilter =
|
|
CALCULATE (
|
|
NOT ISEMPTY ( Fields_Merged_Data ),
|
|
TREATAS ( { 5, 3 }, Fields_Merged_Data[Value5] )
|
|
)
|
|
VAR _isfilter_city =
|
|
ISFILTERED ( Dim_Geo[CITY_C] )
|
|
|| ISFILTERED ( Dim_Geo[MERGED_DATA_CITY_C] )
|
|
|| CALCULATE (
|
|
NOT ISEMPTY ( Fields_Merged_Data ),
|
|
KEEPFILTERS (
|
|
TREATAS (
|
|
{ 313, 314 },
|
|
Fields_Merged_Data[Fields_Merged_Data Order]
|
|
)
|
|
)
|
|
)
|
|
RETURN
|
|
SWITCH (
|
|
TRUE ( )
|
|
, ISFILTERED ( Dim_Market ) || ISFILTERED ( Dim_BrandDefaultMKT )
|
|
|| ISFILTERED ( Dim_MarketTA[TA] ),
|
|
CALCULATE (
|
|
SWITCH (
|
|
TRUE ( )
|
|
,
|
|
// 筛选city dtp不参与计算
|
|
( OR ( ISFILTERED ( Dim_Org ), ISFILTERED ( Dim_Geo ) )
|
|
|| _isfilter )
|
|
&& ( NOT [IsMerge] )
|
|
&& _isfilter_city,
|
|
CALCULATE (
|
|
SELECTEDMEASURE ( )
|
|
, KEEPFILTERS ( Dim_MergeDataSource[DATA_SOURCE] <> "DTP" )
|
|
, USERELATIONSHIP ( Dim_MergeDataSource[DATA_SOURCE], Fact_Sales[MERGEDATA_FLAG_MKT] )
|
|
, KEEPFILTERS ( Fact_Sales[MERGED_DATA_DTP_OTHERS] <> "3" )
|
|
, KEEPFILTERS ( Fact_Sales[DTP_FLAG] <> 1 ) // 筛选city dtp不参与计算
|
|
)
|
|
,
|
|
// 不筛选city dtp参与计算
|
|
( OR ( ISFILTERED ( Dim_Org ), ISFILTERED ( Dim_Geo ) )
|
|
|| _isfilter )
|
|
&& ( NOT [IsMerge] ),
|
|
CALCULATE (
|
|
SELECTEDMEASURE ( )
|
|
, KEEPFILTERS ( Dim_MergeDataSource[DATA_SOURCE] <> "DTP" )
|
|
, USERELATIONSHIP ( Dim_MergeDataSource[DATA_SOURCE], Fact_Sales[MERGEDATA_FLAG_MKT] )
|
|
, KEEPFILTERS ( Fact_Sales[MERGED_DATA_DTP_OTHERS] <> "3" )
|
|
, KEEPFILTERS ( Fact_Sales[DTP_FLAG] <> 1 )
|
|
)
|
|
,
|
|
// 筛选city dtp不参与计算
|
|
( ISFILTERED ( Dim_Org ) || ISFILTERED ( Dim_Geo ) || _isfilter )
|
|
&& _isfilter_city,
|
|
CALCULATE (
|
|
SELECTEDMEASURE ( )
|
|
, USERELATIONSHIP ( Dim_MergeDataSource[DATA_SOURCE], Fact_Sales[MERGEDATA_FLAG_MKT] )
|
|
, KEEPFILTERS ( Fact_Sales[MERGED_DATA_DTP_OTHERS] <> "3" )
|
|
, KEEPFILTERS ( Fact_Sales[DTP_FLAG] <> 1 ) // 筛选city dtp不参与计算
|
|
)
|
|
,
|
|
// 不筛选city dtp参与计算
|
|
( ISFILTERED ( Dim_Org ) || ISFILTERED ( Dim_Geo ) || _isfilter ),
|
|
CALCULATE (
|
|
SELECTEDMEASURE ( )
|
|
, USERELATIONSHIP ( Dim_MergeDataSource[DATA_SOURCE], Fact_Sales[MERGEDATA_FLAG_MKT] )
|
|
, KEEPFILTERS ( Fact_Sales[MERGED_DATA_DTP_OTHERS] <> "3" )
|
|
)
|
|
,
|
|
// 筛选city dtp不参与计算
|
|
_isfilter_city,
|
|
CALCULATE (
|
|
SELECTEDMEASURE ( )
|
|
, USERELATIONSHIP ( Dim_MergeDataSource[DATA_SOURCE], Fact_Sales[MERGEDATA_FLAG_CHAP_DTP_NOAIA] )
|
|
, KEEPFILTERS ( Fact_Sales[MERGED_DATA_DTP_OTHERS] <> "3" )
|
|
, KEEPFILTERS ( Fact_Sales[DTP_FLAG] <> 1 ) // 筛选city dtp不参与计算
|
|
)
|
|
,
|
|
//不选dtp
|
|
NOT [IsMerge],
|
|
CALCULATE (
|
|
SELECTEDMEASURE ( )
|
|
, KEEPFILTERS ( Dim_MergeDataSource[DATA_SOURCE] <> "DTP" )
|
|
, USERELATIONSHIP ( Dim_MergeDataSource[DATA_SOURCE], Fact_Sales[MERGEDATA_FLAG_CHAP_DTP_NOAIA] )
|
|
, KEEPFILTERS ( Fact_Sales[MERGED_DATA_DTP_OTHERS] <> "3" )
|
|
, KEEPFILTERS ( Fact_Sales[DTP_FLAG] <> 1 )
|
|
)
|
|
,
|
|
// 不筛选city dtp参与计算
|
|
CALCULATE (
|
|
SELECTEDMEASURE ( )
|
|
, USERELATIONSHIP ( Dim_MergeDataSource[DATA_SOURCE], Fact_Sales[MERGEDATA_FLAG_CHAP_DTP_NOAIA] )
|
|
, KEEPFILTERS ( Fact_Sales[MERGED_DATA_DTP_OTHERS] <> "3" )
|
|
)
|
|
)
|
|
, KEEPFILTERS (
|
|
Dim_Market[MKT_SOURCE] <> "Amivantamab MarketDTP(Quarterly)"
|
|
)
|
|
, KEEPFILTERS (
|
|
NOT Dim_Market[MARKET] IN
|
|
{
|
|
"RE Market",
|
|
"Respules Market",
|
|
"RE Market (Global)",
|
|
"RE Extended Market",
|
|
"Pulmicort VBP Benchmark Market",
|
|
"TCM Market"
|
|
}
|
|
)
|
|
)
|
|
)
|
|
|
|
column mergedata_5_2
|
|
dataType: string
|
|
lineageTag: ecc49b49-ac91-4771-b6c5-8d73a0e7def4
|
|
summarizeBy: none
|
|
sourceColumn: Name
|
|
sortByColumn: Ordinal
|
|
|
|
annotation SummarizationSetBy = Automatic
|
|
|
|
column Ordinal
|
|
dataType: int64
|
|
formatString: 0
|
|
lineageTag: 5e3db0d8-34b0-4c87-87ee-ad91439771b3
|
|
summarizeBy: sum
|
|
sourceColumn: Ordinal
|
|
|
|
annotation SummarizationSetBy = Automatic
|
|
|
|
annotation TabularEditor_TableGroup = 02_CalGroup
|
|
|