我需要有关 DAX 中多个 if 语句语法的帮助
我的表中有数据 “删除所有职业能力 (2) 标志” 和
专栏 “雇员补偿有效期至”
我想设置一个度量来告诉我们(下面是我的伪代码)
If 'Emp Comp Valid Until' <Today, "Expired",
If 'Emp Comp Valid Until' Between Today And Today +28, "1 Pd",
If 'Emp Comp Valid Until' Between Today +28 And Today +56, "2 Pds",
If 'Emp Comp Valid Until' Between Today +56 And Today +84, "3 Pds",
)
欢迎任何帮助 - 提前致谢!
这是等效的 DAX 代码:
Switch(True()
, [Emp Comp Valid Unit] < Today(), "Expired"
, [Emp Comp Valid Unit] >= Today() && [Emp Comp Valid Unit] < Today() + 28, "1 Pd"
, [Emp Comp Valid Unit] >= Today() + 28 && [Emp Comp Valid Unit] < Today() + 56, "2 Pds"
, [Emp Comp Valid Unit] >= Today() + 56 && [Emp Comp Valid Unit] < Today() + 84, "3 Pds"
)