在 Power BI 中显示为另一列的百分比 [英] Show as percentage of another column in Power BI

查看:401
本文介绍了在 Power BI 中显示为另一列的百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张看起来像这样的桌子

I have a table that looks like this

|        Date         |  Total  |  Loss  |
|---------------------|---------|--------|
|     Jan 1 2018      |   90    |    5   |
|---------------------|---------|--------|
|     Jan 3 2018      |   10    |    5   |
|---------------------|---------|--------|
|     Feb 1 2018      |   50    |    5   |
|---------------------|---------|--------|
|     Feb 3 2018      |   50    |   10   |
|---------------------|---------|--------|

我希望能够在表格中显示总"损失"的百分比取决于时间段.

I wanna be able to show in a table how much percentage of "Total" "Loss" is depending on the period.

例如,如果在我的仪表板中我将表格可视化器显示为月份,它应该给出:

For example if in my dashboard I show the table visualizer as months, it should give :

|        Date         |  Loss % |
|---------------------|---------|
|      Jan 2018       |   10%   |
|---------------------|---------|
|      Feb 2018       |   15%   |
|---------------------|---------|

但是如果我把它显示为年份,它应该给出:

But if I show it as year, it should give :

|        Date         |  Loss % |
|---------------------|---------|
|        2018         |  12.5%  |
|---------------------|---------|

现在我找到的唯一解决方案是在数据"选项卡中创建表格,以汇总每个月的主表格.但这对我来说不是一个永久的解决方案(我最终有太多的表,因为我必须为许多不同的列和相互冲突的关系做那种表).

Right now the only solution I have found is to create tables in the Data tab that would sum up my main table for each Month. But that can't be a permanent solution to me (I end up with too many tables, as I have to do that kind of table for many different columns and conflicting relationships).

推荐答案

我通过将以下度量添加到您的表中获得了相同的结果 LossPercent = 100 * SUM(SalesData[Loss])/SUM(SalesData[Total]),然后添加日期和日期表之间的关系,其中包含将日期细分为要显示的分组.

I achieved the same result by adding the following measure to your table LossPercent = 100 * SUM(SalesData[Loss]) / SUM(SalesData[Total]), then adding a relationship between the date and a Dates table, which contains a breakdown of dates into the groupings you want to display.

这篇关于在 Power BI 中显示为另一列的百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆