【发布时间】:2019-10-22 19:35:04
【问题描述】:
我正在处理从 tableau 到 power bi 的仪表板转换。卡在 tableau 中的计算维度需要使用 dax 转换为 powerbi!
通过替换 tableau 中的 IFNULL 语句。我已经尝试使用 IF 语句在 dax 中使用 ISBLANK 参数,该语句应该检查该字段是否返回空值。我对 dax 的了解是有限的,我想这个问题真的很简单,但我坚持了好几个小时。
需要转换成powerbi的tableau代码:
if LEFT([Supplier Code],1) = "E" then "Employees Claims" else
IF
IFNULL(IFNULL([ASL Supplier (SWPS)],IFNULL([Supplier Name],IFNULL([Vendor],[Supplier Code]))),'Not Define')= 'N/A'
THEN IFNULL([Vendor],[Supplier Name]) ELSE
IFNULL(IFNULL([ASL Supplier (SWPS)],IFNULL([Supplier Name],IFNULL([Vendor],[Supplier Code]))),'Not Define')
END
END
我尝试过的 Power bi 代码:
Supplier (swps) = IF(LEFT([Supplier Code],1) = "E", "Employee Claims",
IF(
IF(ISBLANK(V_FIPnLDashboard_Tne[ASL Supplier (SWPS)]),ISBLANK(V_FIPnLDashboard_Tne[Supplier Name]),ISBLANK(V_FIPnLDashboard_Tne[Supplier Code])),"Not Define") = "N/A")
我的代码不完整,因为我无法理解 tableau 中代码的完整分解。
画面:
if LEFT([Supplier Code],1) = "E" then "Employees Claims" else
IF
IFNULL(IFNULL([ASL Supplier (SWPS)],IFNULL([Supplier Name],IFNULL([Vendor],[Supplier Code]))),'Not Define')= 'N/A'
THEN IFNULL([Vendor],[Supplier Name]) ELSE
IFNULL(IFNULL([ASL Supplier (SWPS)],IFNULL([Supplier Name],IFNULL([Vendor],[Supplier Code]))),'Not Define')
END
END
预期结果是一个维度/列,其值作为 power bi 中的给定条件。
【问题讨论】:
-
我认为,如果您无需尝试将 Tableau 转换为 DAX,您只需提供数据样本、描述您的数据模型和所需的结果,您将更轻松、更快地实现目标。从头开始解决这些问题比处理转换复杂性要容易得多。
标签: if-statement powerbi tableau-api dax ifnull