我正在尝试创建KPI,为此我尝试创建一个变量
我有这个公式
Total_Sales_Variable =
IF (
VALUES (BillingDocument_Header[Billing Doc. currency_WAK] ) = "USD",
139.2,
1
) *
CALCULATE (
SUM (BillingDocument_Item[Sales Amount_NEWR]),
FILTER (
'Invoice_Calender',
'Invoice_Calender'[Fiscal_Year] = 2016 &&
'Invoice_Calender'[Fiscal_Year] = 2017
),
FILTER (
'BillingDocument_Header',
'BillingDocument_Header'[Bill Type_FKRT] <> "Z2" &&
'BillingDocument_Header'[Bill Type_FKRT] <> "Z2"
)
)
添加时显示错误
MdxScript(Model)(8,5)度量'Invoice_Calender'[Total_Sales_Variable]中的计算错误:提供了多个值的表,其中应有一个值。
我正在尝试实现Billing Doc。 currency_WAk是美元,那么我想对该字段Sales Amount_NEWR加上过滤器Fiscal_Year = {'2016','2017'}和[Billing Type_FKART] = {'ZG2','ZL2'}
这是我要在power bi中实现的目标,我想将其转换为dax表达式power bi qlik感觉表达
if([Billing Doc. currency_WAERK] = 'USD',
sum({< Fiscal_Year = {'2016','2017'},[Billing Type_FKART] -={'ZG2','ZL2'}>}[Billing Sales Amount_NETWR])*139.2,
sum({< Fiscal_Year = {'2016','2017'},[Billing Type_FKART] -={'ZG2','ZL2'}>}[Billing Sales Amount_NETWR]))
有什么帮助吗?
更新附件文件
请使用数据和表格检查pbix文件
答案 0 :(得分:1)
编辑:现在,我们终于可以清楚地了解您的表结构和关系,并了解您所需的度量!
Total Sales Variable =
CALCULATE (
SUMX (
VALUES ( test_billing_doc_header[Billing Doc. currency_WAERK] ),
IF (
test_billing_doc_header[Billing Doc. currency_WAERK] = "USD",
139.2,
1
) * SUM ( test_biilingg_doc_item[Billing Sales Amount_NETWR] )
),
Invoice_Calender[Fiscal_Year] = 2016 || Invoice_Calender[Fiscal_Year] = 2017,
test_billing_doc_header[Billing Type_FKART] <> "ZG2" && test_billing_doc_header[Billing Type_FKART] <> "ZL2"
)