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
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
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.