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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Is it possible to dynamically change which grouping is displayed?

 Hi
I have created two different groupings (1-2,3-4,5-10) and (1-3,4-7, Other).
The groupings are used as legende in a bar chart.
Is it possible eg. with a slicer, to dynamically change which grouping is displayed? or is there another way to do this?

2 ACCEPTED SOLUTIONS
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Do you mean you'd like to dynamically change the legend displaying? 

I'm afraid it's not able to use slicer to change legend dynamically based on checked column names from the slicer visual currently. The workaround is to create drill down report.

You might refer to below similar threads:

https://community.powerbi.com/t5/Desktop/change-the-legend-labels-dynamically-based-on-the-value-selected/td-p/551341 

https://community.powerbi.com/t5/Desktop/Dynamic-Legend/td-p/18745 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

MFelix
Super User
Super User

Hi  @Anonymous ,

 

I know you already marked this as solved but this is available make some additonal table for your slicer settings:

 

 

Slicer =
UNION (
    //Group 1
    SUMMARIZE (
        'Table';
        'Table'[Category];
        "Legend"; VALUES ( 'Table'[Category (groups 1)] );
        "Slicer"; "GROUP1"
    );
    //Group 2
    SUMMARIZE (
        'Table';
        'Table'[Category];
        "Legend"; VALUES ( 'Table'[Category (groups 2)] );
        "Slicer"; "GROUP2"
    )
)

 

 

Now that you have this table createa relationship between the category on this table and the category on the other table this will create a many to many relationship with filter for both side.

 

Now just add the column Legend to your legend on the bar chart and the column or measure you need to the values.

 

Be aware that you need that the slicer be with unique values otherwise you will get all the values on your table check PBIX file attach:

Groups_Legend.gif

 

This can also be used to change values of axis based on different columns as products, countrys and so on.


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

5 REPLIES 5
MFelix
Super User
Super User

Hi  @Anonymous ,

 

I know you already marked this as solved but this is available make some additonal table for your slicer settings:

 

 

Slicer =
UNION (
    //Group 1
    SUMMARIZE (
        'Table';
        'Table'[Category];
        "Legend"; VALUES ( 'Table'[Category (groups 1)] );
        "Slicer"; "GROUP1"
    );
    //Group 2
    SUMMARIZE (
        'Table';
        'Table'[Category];
        "Legend"; VALUES ( 'Table'[Category (groups 2)] );
        "Slicer"; "GROUP2"
    )
)

 

 

Now that you have this table createa relationship between the category on this table and the category on the other table this will create a many to many relationship with filter for both side.

 

Now just add the column Legend to your legend on the bar chart and the column or measure you need to the values.

 

Be aware that you need that the slicer be with unique values otherwise you will get all the values on your table check PBIX file attach:

Groups_Legend.gif

 

This can also be used to change values of axis based on different columns as products, countrys and so on.


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



Anonymous
Not applicable

Hi again Miguel.
Thank you for your time and your elegant solution. I need the solution to divide population data into different age groups. After digging further into the topic, I found a solution from Guy in a Cube that I have chosen to use. In this solution the grouping is done in power query. Before I saw your solution, it had not occurred to me that the solution could work for both axes and legends.

v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Do you mean you'd like to dynamically change the legend displaying? 

I'm afraid it's not able to use slicer to change legend dynamically based on checked column names from the slicer visual currently. The workaround is to create drill down report.

You might refer to below similar threads:

https://community.powerbi.com/t5/Desktop/change-the-legend-labels-dynamically-based-on-the-value-selected/td-p/551341 

https://community.powerbi.com/t5/Desktop/Dynamic-Legend/td-p/18745 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
MFelix
Super User
Super User

Hi @Anonymous ,

 

If you look at the table you can see the group you have created (has an icon of a square divided in 4) you can use that group / binning in a slicer and that will filter out your bar chart.

 

 


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



Anonymous
Not applicable

Hi Miguel - thanks for your quick response. 

What I need do, is to be able to choose between 2 different groupings and not between the elements in one grouping.

regards
Søren

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.