英文:
How to get filtered value of an item as line chart which is absent from column chart in combined chart in Power BI?
问题
我有一个包含2023年和2050年五种产品(A、B、C、D和E)销售数据的数据集,它的形式是一个数据透视表,如下所示:
我想要制作一个组合图表,显示A、B、C和D作为柱状图,而E作为折线图。我选择年份作为横轴,产品作为图例,销售总额作为系列来创建数据透视图。
最初,图表如下所示:
但使用组合图表功能,我选择产品E作为折线图,得到所需的图表:
我试图在Power BI 中做类似的事情。
我还创建了一个新的度量 E_sales
:
E_sales = CALCULATE(SUM(sheet1[sales]), FILTER(sheet1, sheet1[Product] = "E"))
但我想从柱状图中移除E。当我从柱状图中过滤掉E时,E的折线图也被移除了。我该如何修复这个问题,以便只有A、B、C和D显示为柱状图,而E显示为折线图,就像在Excel中所示?
英文:
I have a dataset of sales values of five products: A, B, C, D and E in the form of pivot table for 2030 and 2050 which looks as follows:
I want to get combined chart showing A, B, C and D as columns. And E as line.
I select Year as axis, Product as legend and Sum of sales as series to get the pivot chart.
Initially, the chart looks as follows:
But using the combined chart feature, I select product E as line chart and get the required chart:
I am trying to do something similar in Power BI.
I also created a new measure E_sales
:
E_sales = Calculate(sum(sheet1[sales]), filter(sheet1, Sheet1[Product]="E"))
However, I want to remove E from the column chart. And when I filter out E from column chart, the line for E also get removed. How can I fix this such that I have only A, B, C and D as columns and E as line chart similar to what I have in Excel above?
答案1
得分: 1
我通过创建一个新的度量来解决了这个问题,该度量排除了产品 E,并将其用于列数值,并且对于行数值使用了仅包括 E 值的度量。
ProductExceptE = calculate(sum(Sheet1[Sales]), filter(sheet1, Sheet1[Product]<>"E"))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论