如何使用dax计算平均重量
How to calculate weight average using dax
我的模型中有两个度量(速度、结转)。我想计算此度量的权重并使用以下逻辑创建一个新度量。
If Velocity >85 then set Score=5
else If Velocity is >70 and <85 set score=3
else If Velocity <70 then set score=1
then multiply resulted score by 60%(weight-0.6) then store the Result 1.
If Carry Over <10 then set Score=5
else If Carry Over is > 10 and <20 then set Score=3
else If Carry Over is > 20 then set Score=1
Then multiply resulted Score by 40%(weight-0.4) and store the Result 2.
then Desired value Final Measure =Result 1+ Result 2
我尝试编写一个 dax,但我不确定如何将它存储在多个表达式的变量中并获得一个最终度量。
Score1 =
IF(
'Sprints'[Velocity %] > 85,
"5",
IF(
'Sprints'[Velocity %] < 85 && 'Sprints'[Velocity %] >70,
"3",
If('Sprints'[Velocity %] < 70,"1"
)))
我是 dax 和 powerbi 的新手..感谢您的帮助。
你可以试试这个。
Measure =
VAR Velocity =
IF (
'Sprints'[velocity %] > 85,
5,
IF (
'Sprints'[Velocity %] < 85
&& 'Sprints'[Velocity %] > 70,
3,
IF ( 'Sprints'[Velocity %] < 70, 1 )
)
)
VAR Carryover =
IF (
'Sprints'[Carry Over] < 10,
5,
IF (
'Sprints'[Carry Over] > 10
&& 'Sprints'[Carry Over] < 20,
3,
IF ( 'Sprints'[Velocity %] > 20, 1 )
)
)
VAR Res1 = 0.6 * Velocity
VAR Res2 = 0.4 * Carryover
RETURN
( Res1 + Res2 )
我的模型中有两个度量(速度、结转)。我想计算此度量的权重并使用以下逻辑创建一个新度量。
If Velocity >85 then set Score=5
else If Velocity is >70 and <85 set score=3
else If Velocity <70 then set score=1
then multiply resulted score by 60%(weight-0.6) then store the Result 1.
If Carry Over <10 then set Score=5
else If Carry Over is > 10 and <20 then set Score=3
else If Carry Over is > 20 then set Score=1
Then multiply resulted Score by 40%(weight-0.4) and store the Result 2.
then Desired value Final Measure =Result 1+ Result 2
我尝试编写一个 dax,但我不确定如何将它存储在多个表达式的变量中并获得一个最终度量。
Score1 =
IF(
'Sprints'[Velocity %] > 85,
"5",
IF(
'Sprints'[Velocity %] < 85 && 'Sprints'[Velocity %] >70,
"3",
If('Sprints'[Velocity %] < 70,"1"
)))
我是 dax 和 powerbi 的新手..感谢您的帮助。
你可以试试这个。
Measure =
VAR Velocity =
IF (
'Sprints'[velocity %] > 85,
5,
IF (
'Sprints'[Velocity %] < 85
&& 'Sprints'[Velocity %] > 70,
3,
IF ( 'Sprints'[Velocity %] < 70, 1 )
)
)
VAR Carryover =
IF (
'Sprints'[Carry Over] < 10,
5,
IF (
'Sprints'[Carry Over] > 10
&& 'Sprints'[Carry Over] < 20,
3,
IF ( 'Sprints'[Velocity %] > 20, 1 )
)
)
VAR Res1 = 0.6 * Velocity
VAR Res2 = 0.4 * Carryover
RETURN
( Res1 + Res2 )