power BI 中的表达

问题描述 投票:0回答:1

我有一个 qlik sense 语法的表达式,现在我想将其更改/转换为 power bi dax 语法..我该怎么做

  if([Curency] = 'USD',
((Sum({< Fiscal_Year = {'2016','2017'},[Type_Billing] ={'N2','Z2'}>}[BSMA])
/Sum({< Fiscal_Year = {'2016','2017'},[Type_Billing] ={'N2','Z2'}>}[BSA_NETWR]))*vCurrency),
Sum({< Fiscal_Year = {'2016','2017'},[Type_Billing] ={'N2','Z2'}>}[BSMA])
/Sum({< Fiscal_Year = {'2016','2017'},[Type_Billing] ={'N2','Z2'}>}[BSA_NETWR]))

注意:目前我没有任何 power bi 文件

expression powerbi qliksense
1个回答
0
投票

你可以尝试:

VAR USDFilter = 
CALCULATE(
    FILTER(
        ALL('your_table_name'),
        'your_table_name'[Curency] = "USD"
    )
)

VAR Numerator = 
SUMX(
    USDFilter,
    USDFilter[BSMA]
)

VAR Denominator = 
SUMX(
    USDFilter,
    USDFilter[BSA_NETWR]
)

VAR Result = 
IF(
    COUNTROWS(USDFilter) > 0,
    (Numerator / Denominator) * [vCurrency],
    (Numerator / Denominator)
)

RETURN Result

要转录代码语言,Bard 和 Chat GPT 是一个不错的选择。

© www.soinside.com 2019 - 2024. All rights reserved.