如何将同一列中的两个值划分为多个行?

时间:2019-04-24 12:48:26

标签: powerbi dax

我正在Power BI中创建一个仪表板以可视化一些指标。数据是从Excel工作表中收集的,所有内容均按阶段进行排序。项目名称会针对每个指标重复,并在多个阶段重复,直到它们到达末尾。

问题是,我需要对某些学习/实验比率和学习速度进行可视化处理,但是很难对数据进行划分以获取比率。 (有效学习次数除以与客户进行的实验次数)

我尝试了多种方法,例如度量,度量列,创建参考表,但是我很难做自己需要的事情。

我当前的数据设置: data excel

LE Ratio = 
CALCULATE (
    SUM ( 'New Pilot Metrics'[Numeric metric value] );
    FILTER ( 'New Pilot Metrics'; 'New Pilot Metrics'[Innovation Metric] = "Number of validated learnings" )
)
    / CALCULATE (
        SUM ( 'New Pilot Metrics'[Numeric metric value] );
        FILTER (
            ALLEXCEPT ( 'New Pilot Metrics'; 'New Pilot Metrics'[Innovation Stage] );
               'New Pilot Metrics'[Innovation Metric] = "Number of experiments with customer"
        )
    )

这是我得到的最接近的数字,我希望它可以为每个阶段或至少每个项目名称计算一次,但是它可以完成所有工作。

我可以在excel文件本身中做到这一点(这是一个虚拟对象),但目前正在使用真正的协议,并且需要我请多人参与进行更正。

2 个答案:

答案 0 :(得分:0)

您的LE Ratio度量可能是:

LE Ratio = 
VAR TotalLearnings = 
    CALCULATE ( 
        SUM ( 'New Pilot Metrics'[Numeric metric value] ),
        FILTER ( 
            'New Pilot Metrics',
            'New Pilot Metrics'[Innovation Metric] = "Number of validated learnings"
        )
    ) + 0
VAR TotalExperiments = 
    CALCULATE ( 
        SUM ( 'New Pilot Metrics'[Numeric metric value] ),
        FILTER ( 
            'New Pilot Metrics',
            'New Pilot Metrics'[Innovation Metric] = "Number of experiments with customer"
        )
    ) + 0
RETURN
    DIVIDE ( 
        TotalLearnings,
        TotalExperiments,
        BLANK()
    )

哪个可以返回类似的内容:

enter image description here

答案 1 :(得分:0)

奥利的答案就像魅力!

休息一下之后,我还可以用更简单的代码解决它。

L/E Ratio = 
DIVIDE (
    CALCULATE ( SUM ( 'New Pilot Metrics'[Numeric metric value]); 'New Pilot Metrics'[Innovation Metric] = "Number of validated learnings" );
    CALCULATE ( SUM ( 'New Pilot Metrics'[Numeric metric value]); 'New Pilot Metrics'[Innovation Metric] = "Number of experiments with customer" )
)