Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Carlos_Ponce
Frequent Visitor

Can`t put legends in a two measures stacked bar chart

Hi, I have a chart with two measures, one with positive and other with negative values, like this

Carlos_Ponce_0-1650889218361.png

And the problem is that I can't put the legends of the different items so that each bar is split in differents colors, something like this (I had to put two different charts to do that)

 

Carlos_Ponce_1-1650889340359.png

 

When I have only one measure in the chart i can put legends, but not when I have two measures.

Thanks a lot

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @Carlos_Ponce ,

 

You cannnot have legends and more than one measure on the visualizations is one of the limitations, for this to work you would need to have a table with a MGI or using calculation groups so you would have the measures on the calculation and the values on the legends.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Hi @Carlos_Ponce ,

 

MGI is Mother-Generated Index calculation meaning that you would have a table similar to this:

 

Index Measure
1 Measure 1
2 Measure 2
3 Measure 3
4 Measure 4

 

Then using a Switch metric you would pull each metric for the visualization.

 

Similar to:

 

Metric Value =

SWITCH (
    SELECTEDVALUE ( Table[Index] ),
    1, [Measure 1],
    2, [Measure 2],
    3, [Measure 3],
    4, [Measure 4]
)

 

 

Now if you use the Column on the table on top for the Legend and the Measure to the values you get multiple measures with legend.

 

It seems to me that you have a variable number of values that will be picked up base on a categorization or something similar, that will be a lot of values and not a small number so would be doable but maybe hard coding a little.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @Carlos_Ponce ,

 

You cannnot have legends and more than one measure on the visualizations is one of the limitations, for this to work you would need to have a table with a MGI or using calculation groups so you would have the measures on the calculation and the values on the legends.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix thanks a lot for the answer.

Im a little new in this, what dos it mean table whith MGI? I searched in internet but didnt find it.

Hi @Carlos_Ponce ,

 

MGI is Mother-Generated Index calculation meaning that you would have a table similar to this:

 

Index Measure
1 Measure 1
2 Measure 2
3 Measure 3
4 Measure 4

 

Then using a Switch metric you would pull each metric for the visualization.

 

Similar to:

 

Metric Value =

SWITCH (
    SELECTEDVALUE ( Table[Index] ),
    1, [Measure 1],
    2, [Measure 2],
    3, [Measure 3],
    4, [Measure 4]
)

 

 

Now if you use the Column on the table on top for the Legend and the Measure to the values you get multiple measures with legend.

 

It seems to me that you have a variable number of values that will be picked up base on a categorization or something similar, that will be a lot of values and not a small number so would be doable but maybe hard coding a little.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.