使用 what if 参数和使用切片器
Using what if parameters and using slicer
我有一个 table 条目如下-
filenumber|metric1|metric2|metric3|overall score
1 90 80 70 ?
需求是生成总分栏。用户应该能够 select 在计算总分时考虑哪个指标,并且能够为每个指标分配权重。例如,在上一行中,
如果用户selects metric1 和 metric2 分别分配了0.7和0.3的权重,总分应该是
0.7*90+0.3*80 = 87
我试过使用what if 参数让用户设置权重。此外,我已将非透视列用于 select 特定指标,但我无法将这两个要求结合起来。
提前致谢。
下面是措施,你应该按照你的情况-
overall score =
VAR number_of_applied_Weightage =
IF(what_if_metric_1[metric_1 Value] > 0,1,0)+
IF(what_if_metric_2[metric_2 Value] > 0,1,0)+
IF(what_if_metric_3[metric_3 Value] > 0,1,0)
VAR total_score_current_row =
(MIN(what_if_parameter[metric1])*[metric_1 Value]) +
(MIN(what_if_parameter[metric2])*[metric_2 Value]) +
(MIN(what_if_parameter[metric3])*[metric_3 Value])
VAR average_score_current_row =
IF(
number_of_applied_Weightage = 0,
0,
total_score_current_row/number_of_applied_Weightage
)
RETURN average_score_current_row
如下图所示,这里可以正常工作-
最后,要计算所有的总分,您可以创建另一个度量,如下所示-
average overll score = AVERAGEX(what_if_parameter,[overall score])
我有一个 table 条目如下-
filenumber|metric1|metric2|metric3|overall score
1 90 80 70 ?
需求是生成总分栏。用户应该能够 select 在计算总分时考虑哪个指标,并且能够为每个指标分配权重。例如,在上一行中,
如果用户selects metric1 和 metric2 分别分配了0.7和0.3的权重,总分应该是
0.7*90+0.3*80 = 87
我试过使用what if 参数让用户设置权重。此外,我已将非透视列用于 select 特定指标,但我无法将这两个要求结合起来。
提前致谢。
下面是措施,你应该按照你的情况-
overall score =
VAR number_of_applied_Weightage =
IF(what_if_metric_1[metric_1 Value] > 0,1,0)+
IF(what_if_metric_2[metric_2 Value] > 0,1,0)+
IF(what_if_metric_3[metric_3 Value] > 0,1,0)
VAR total_score_current_row =
(MIN(what_if_parameter[metric1])*[metric_1 Value]) +
(MIN(what_if_parameter[metric2])*[metric_2 Value]) +
(MIN(what_if_parameter[metric3])*[metric_3 Value])
VAR average_score_current_row =
IF(
number_of_applied_Weightage = 0,
0,
total_score_current_row/number_of_applied_Weightage
)
RETURN average_score_current_row
如下图所示,这里可以正常工作-
最后,要计算所有的总分,您可以创建另一个度量,如下所示-
average overll score = AVERAGEX(what_if_parameter,[overall score])