admin管理员组

文章数量:1122846

I have data1 which looks as shown below:

My data2 looks as shown:

I want to create a stacked column chart for data1. I create two measures for Installed Capacity and SentOut Demand in Power BI as shown:

Installed Capacity = Calculate(sum(data1[Capacity]), filter(data1, data1[Technology]<>"Demand"))
SentOut Demand = Calculate(sum(data1[capacity]), filter(data1, data1[Technology] = "Demand"))

I merge the Order in data2 with data1 and extend data1.

I plot stacked column and line chart with

x-axis: Year
Column y-axis: Installed capacity
Line y-axis: SentOut Demand
Column legend: Technology

In stacked column and line chart, I sort the Technology based on Data2.order. And get the following plot. It looks good. However, the order of stacked columns (bottom to top) is just opposite to the order of legends (top to bottom). What can I do to make them of the same order?

The *.pbix file is present here

I have data1 which looks as shown below:

My data2 looks as shown:

I want to create a stacked column chart for data1. I create two measures for Installed Capacity and SentOut Demand in Power BI as shown:

Installed Capacity = Calculate(sum(data1[Capacity]), filter(data1, data1[Technology]<>"Demand"))
SentOut Demand = Calculate(sum(data1[capacity]), filter(data1, data1[Technology] = "Demand"))

I merge the Order in data2 with data1 and extend data1.

I plot stacked column and line chart with

x-axis: Year
Column y-axis: Installed capacity
Line y-axis: SentOut Demand
Column legend: Technology

In stacked column and line chart, I sort the Technology based on Data2.order. And get the following plot. It looks good. However, the order of stacked columns (bottom to top) is just opposite to the order of legends (top to bottom). What can I do to make them of the same order?

The *.pbix file is present here

Share Improve this question edited yesterday hbstha123 asked yesterday hbstha123hbstha123 1,60618 silver badges39 bronze badges 2
  • Can you share a .pbix so we don't have to type everything out – davidebacci Commented yesterday
  • 1 I don't think it can be uploaded. So I shared a link. – hbstha123 Commented yesterday
Add a comment  | 

1 Answer 1

Reset to default 1

This is a limitation of the native visual unfortunately. If you want more control, you'd have to look at something like Deneb.

Edit

You can hide the default legend and then create a fake one using another native visual. It is a hack but will achieve what you want visually and will still cross filter appropriately.

本文标签: plotSorting the order of legend and stacked column in the same order in Power BIStack Overflow