Microsoft Power BI 添加双列

huangapple go评论62阅读模式
英文:

Microsoft Power BI Add Double Column

问题

我可以帮你翻译这部分:

我有一个数据库中的表格,格式如下:

id object_name stock lowest_price highest_price
1 牛奶 100 10 20
2 面包 95 5 15

我想在 Power BI 中可视化成这样:

期望输出

是否可能?我该如何操作?

我想要达到上面图片中的效果。

英文:

I have table from Database with format below:

id object_name stock lowest_price highest_price
1 milk 100 10 20
2 bread 95 5 15

I want to visualize in Power BI like this:

Desired Output

Is it possible? How I can do it?

I want to visualize it like the picture above

答案1

得分: 0

根据我的理解,您正在尝试将“lowest_price”和“highest_price”列分组到“Price”列标题下,然后从其他列中删除单词“Price”。

不幸的是,普通的 Power BI 不提供分组列的方法。以下是两种解决方法:

方法1:分离标题,固定列宽

您可以在列上方添加一个文本框,然后关闭自动调整列宽。这可以确保表/矩阵中的列和文本框始终对齐,因为它们是分开的对象。

要关闭自动调整列宽:格式 > 列标题 > 自动调整列宽

最终结果将是这样的。

缺点:列宽是静态的。如果您的表需要水平滚动,此方法将无效。

方法2:自定义可视化

在普通的 Power BI 之外,您可以从 Appsource 下载自定义可视化来帮助您进行开发。例如,在这个链接上,您可以下载一个允许您分组列的自定义矩阵。

您最终可能会得到类似这样的结果。

不幸的是,大多数这些表/矩阵自定义可视化需要订阅。

缺点:需要付费订阅。学习如何使用新的可视化工具。

备注

如果您的表/矩阵很简单,我强烈建议选择方法1,因为它非常容易实现并且是免费的!

英文:

From my understanding, you are trying to find a way to group the columns "lowest_price" and "highest_price" under the column header "Price", and then removing the word 'Price' from the other columns.

I've tried to do something similar when I had 8 columns that all had "Cumulative" in the name, thus removing the redundancy of having the word written out 8 times.

Unfortunately, vanilla Power BI does not offer a way to group columns. Here are two work arounds to this:

Method 1: Detached Header, Fixed Column Width

You can add a textbox above the columns, and then turn off auto-size column width. This ensures that the columns in the table/matrix and the textbox is always aligned since they are separate objects.

To turn off auto-size: Format > Column headers > Auto-size column width

This is what the end result will look like.

Cons: Static column width. If your table requires a horizontal scroll, this method will not work.

Method 2: Custom Visual

Outside of vanilla Power BI, you can download custom visuals from Appsource to help you develop. For example, at this link, you can download a custom matrix that does allow you to group columns.

You could end up with something like this.

Unfortunately, most of these table/matrix custom visuals require a subscription.

Cons: Payed subscription. Learning how to use a new visual.

Remarks

If your table/matrix is simple, I would highly recommend going with method 1 as it is very easy to implement and is free!

huangapple
  • 本文由 发表于 2023年5月22日 11:41:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302911.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定