Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Variables 提供了一个包含多个值的表,其中预期只有一个值_Variables_Powerbi_Powerbi Desktop_Kpi - Fatal编程技术网

Variables 提供了一个包含多个值的表,其中预期只有一个值

Variables 提供了一个包含多个值的表,其中预期只有一个值,variables,powerbi,powerbi-desktop,kpi,Variables,Powerbi,Powerbi Desktop,Kpi,我正在尝试创建KPI,为此我尝试创建一个变量 我有这个公式 Total_Sales_Variable = IF ( VALUES (BillingDocument_Header[Billing Doc. currency_WAK] ) = "USD", 139.2, 1 ) * CALCULATE ( SUM (BillingDocument_Item[Sales Amount_NEWR]), FILTER (

我正在尝试创建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"
    )
)
总销售额变量=
如果(
值(账单单据头【账单单据币种】=“USD”,
139.2,
1.
) * 
计算(
金额(账单单据项[销售金额],
过滤器(
“发票日历”,
“发票日历”【会计年度】=2016年&&
“发票日历”【会计年度】=2017年
),
过滤器(
“BillingDocument_标题”,
“票据单据头”[票据类型]“Z2”&&
“票据单据头”[票据类型]“Z2”
)
)
当我添加时,这显示了一个错误

MdxScript(Model)(8,5)度量值“发票日历”[Total_Sales_Variable]中的计算错误:提供了一个包含多个值的表,其中预期只有一个值

我正在尝试实现如果计费文件。货币是美元,那么我想将该字段的销售金额与过滤器会计年度={'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]))
if([账单单据货币]=“USD”,
总额({}[计费销售额网络]*139.2,
总额({<会计年度={'2016','2017'},[计费类型]-={'ZG2','ZL2'}>}[计费销售额网络])
有什么帮助吗

更新附件

请检查带有数据和表格的pbix文件


编辑:现在我们终于清楚了您的表结构和关系,并了解了您所需的度量

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"
)
总销售额变量=
计算(
SUMX(
值(测试账单单据头[账单单据币种],
如果(
测试账单单据头【账单单据币种】=“USD”,
139.2,
1.
)*总额(测试单项目[开票销售金额]
),
发票日历【会计年度】=2016年发票日历【会计年度】=2017年,
测试计费单头[计费类型\u FKART]“ZG2”和测试计费单头[计费类型\u FKART]“ZL2”
)

PBIX文件:

您的问题显示了源数据的样本,以及度量值的预期输出。您好。这对于我来说是不可能放置源数据的,因为数据太大了。。当我使用我在问题中提到的代码时,它只显示了一个错误,一个数据样本,来显示结构和一些有代表性的行……我能显示表和它们的字段吗?我知道样本数据是什么意思。我说这是不可能的,因为行太多了..您好,最后一行。。BillingDocument[Billing Type_FKART]=“ZG2”| | BillingDocument[Billing Type_FKART]=“ZL2我想作为”不等于“签名。。当我replace=to时,这显示了一个错误hi我在评论中已经做了,但这显示了一个错误。当我替换为=时,则没有错误,但当我替换为=时,则显示错误。。。。我希望operator not=在最后一个条件中..再次编辑答案,以使筛选条件更清晰。请检查我在问题中编辑的表格结构这是一个不同的问题-我相信谷歌可以帮助您。