gpt4 book ai didi

dax - Dax 中的案例陈述

转载 作者:行者123 更新时间:2023-12-01 13:27:23 26 4
gpt4 key购买 nike

我有以下 case when 语句:

case when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) < 18.5 then 'Underweight < 18.5'
when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) between 18.5 and 24.9 then 'Normal 18.5-24.9'
when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) between 25.0 and 29.9 then 'Overweight 25-29.9'
when ts.wgt_kg / ((hgt_cm / 100) * (hgt_cm / 100)) > 30.0 then 'Obese > 30.0'
end as BMI

如何将其转换为 DAX?我试图用谷歌搜索它,但找不到任何有用的东西。有人可以帮我吗?谢谢

最佳答案

按照这些思路尝试一些事情:

BMI Category =
VAR BMI = ts.wgt_kg / ( ( hgt_cm / 100 ) * ( hgt_cm / 100 ) )
RETURN
SWITCH (
TRUE (),
BMI < 18.5, "Underweight < 18.5",
BMI < 25.0, "Normal 18.5-24.9",
BMI < 30.0, "Overweight 25-29.9",
"Obese > 30.0"
)

这将返回第一个计算结果为真的条件,或者如果以上都不为真则使用最后一个参数。

关于dax - Dax 中的案例陈述,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47834964/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com