在我的计算表中,变量AsOfDate
应该由切片器dim_Date
反映出来,该切片器也是计算表。
从表CrossTableEffectiveDate
派生而来的计算表fact_Premium
与Date
具有dim_Date
关系。
我收到错误消息:Circular Dependency Calculated Column
CrossTableEffectiveDate =
VAR AsOfDate = VALUE("2019-01-31") //This value should be based on date value in a slicer
VAR CrossTables =
CROSSJOIN(
SUMMARIZE(fact_Premium,
fact_Premium[PolicyNumber],
fact_Premium[CompanyLocationGuid],
fact_Premium[Coverage],
fact_Premium[State],
fact_Premium[SICCode],
fact_Premium[ASLOB],
fact_Premium[ProducerGUID],
"Start", MIN(fact_Premium[EffectiveDate]),
"End", MAX(fact_Premium[ExpirationDate]),
"Premium", SUM(fact_Premium[Premium])
),
'Calendar')
VAR RiskPeriods =
ADDCOLUMNS(
FILTER(CrossTables,
'Calendar'[EoMonth] >= [Start] && 'Calendar'[Month] <= [End] && 'Calendar'[Month] <= AsOfDate),
"StartRiskMonth", IF([Start] > 'Calendar'[Month], [Start], 'Calendar'[Month]),
"EndRiskMonth", IF([End] < 'Calendar'[EoMonth], [End], 'Calendar'[EoMonth])
)
RETURN SELECTCOLUMNS(RiskPeriods,
"PolicyNumber", fact_Premium[PolicyNumber],
"CompanyLocationGUID", fact_Premium[CompanyLocationGuid],
"Coverage",fact_Premium[Coverage],
"State", fact_Premium[State],
"SICCode",fact_Premium[SICCode],
"ASLOB", fact_Premium[ASLOB],
"ProducerGUID",fact_Premium[ProducerGUID],
"StartRiskMonth", [StartRiskMonth],
"EndRiskMonth", [EndRiskMonth],
"YearNum", YEAR('Calendar'[Month]),
"Qtr", ROUNDUP(MONTH('Calendar'[Month])/3, 0),
"MonthNum", MONTH('Calendar'[Month]),
"WrittenPremium", [Premium],
"DaysInMonth", [EndRiskMonth] - [StartRiskMonth] + 1,
//"EndRiskMonth-Start", [EndRiskMonth] - [StartRiskMonth] + 1,
//"End-Start",[End] - [Start] + 1,
"EarnedPremium", [Premium] *
DIVIDE([EndRiskMonth] - [StartRiskMonth] + 1, [End] - [Start] + 1))
如何使AsOfDate
中的Date
切片器引用dim_Date
变量?
答案 0 :(得分:1)
您不能让计算表或计算列依赖于切片器。
这些仅在每次数据加载时计算一次,并且不响应您报表中的任何过滤条件。
您可以对此概念添加支持,以提高Microsoft实施该概念的机会。