if-statement - 如何将tableau中的ifnull语句转换为powerbi dax?
问题描述
我正在处理从 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
预期结果是一个维度/列,其值作为幂 bi 中的给定条件。
解决方案
IF IFNULL([ASL Supplier(SWPS)],IFNULL([Supplier(SWPS)],IFNULL([Vendor],IFNULL([Supplier Code],'Not Define')))) = 'N/A'
THEN [Supplier(SWPS)]
ELSE IFNULL([ASL Supplier (SWPS)],IFNULL([Supplier(SWPS)],IFNULL([Vendor],IFNULL([Supplier Code],'Not Define'))))
END
推荐阅读
- angular - Angular Firebase 用户可以读写自己的数据
- git - 如何将两个 git 存储库作为一个存储库进行管理,但又保持独立?
- azure - Terraform 如何定义一个变量以让用户选择现有资源或创建新资源
- r - 如何在 R 中以 50/50 的夜间和白天时间比率为每个人每天提取一个随机的白天?
- oozie-workflow - 我想在 Hue-> Oozie 中安排 Impala 查询
- visual-studio-code - Visual Studio 代码中的键绑定
- c# - 在 UWP 中使用 windows.media.ocr 提高 OCR 的质量
- algorithm - 在 Uncertain equation 或 2 array 中找到相似的部分
- linkedin - 在 iOS 设备中不显示“应用链接”按钮
- python - Python-打印用逗号分隔的整数序列