简体   繁体   English

计算两列 Power BI 的百分比

[英]Calculate % of two columns Power BI

I want to calculate % of two columns which are already in %.我想计算已经在百分比中的两列的百分比。

I want to calculate formula like我想计算公式

Target achieved= ACTUAL/TARGET达到的目标=实际/目标

But here is ACTUAL is already a measure/calculated metrics so I'm not able to divide these two columns.但是这里 ACTUAL 已经是一个度量/计算的指标,所以我无法划分这两列。

Any help would be appreciated..任何帮助,将不胜感激..

在此处输入图像描述

Make sure both target and actual are actually numbers and not strings.确保目标和实际都是数字而不是字符串。 You can do it in transform data (aka Power Query) part, before data is loaded into the report.在将数据加载到报告中之前,您可以在转换数据(又名 Power Query)部分中执行此操作。

数据转换

After that you should be able to create the measure you want, eg something like that:之后,您应该能够创建所需的度量,例如:

测量完成百分比

UPDATE : What happens if Actual is not a column, but a measure?更新:如果 Actual 不是列,而是度量,会发生什么?

If Actual measure is based on the columns in the same table as target you shouldn't have a problem.如果实际度量基于与目标相同的表中的列,那么您应该没有问题。 You cannot combine measure and column in the same formula.您不能在同一公式中组合度量和列。 Measure is an aggregated field and needs to be grouped by another field (if you are familiar with SQL,think of SUM and GROUP BY). Measure是一个聚合字段,需要由另一个字段分组(如果您熟悉SQL,请考虑SUM和GROUP BY)。 Coming back to your problem, you need to create measure out of "Target" column as well (notice I have in the formula SUM('Table'[Plan]) which makes it a measure).回到您的问题,您还需要从“目标”列中创建度量(注意我在公式 SUM('Table'[Plan]) 中有一个度量)。 Than you can use both of them in the formula, but of course you need to "group" them by something(eg date) otherwise it will just show you a total.你可以在公式中同时使用它们,但当然你需要按某些东西(例如日期)对它们进行“分组”,否则它只会显示一个总数。 以实际为度量的公式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM