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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Fh3r1008
Frequent Visitor

Hide some part of the bar with a selection

Hi all, 

Please I need your help with this issue.

I have a stacked bar chart and a little table called "opcion". I need to hide "some part" of the bar when I select some option of the table:

 

PBI1.jpg

I mean, for example, if I select (in the little table) the word "Recibo"... the chart should be change and only show the blue part of the bars, if I select "Embarque" the chart should only show the gray part of the bars and if I select "Embarque" the orange part of the bars.

 

This is the table that feeds the chart:

PBI2.jpg

 

Thanks in advance and I wait for your answer

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @Fh3r1008 
To achieve a wanted interaction you can apply these steps.
1. From PQ you need to unpivot the table :

Ritaf1983_0-1726889986499.png

2. Close and apply

Ritaf1983_1-1726890019265.png

3 There is 2 scenarios 
3.1 if you want the line of personas to stay when you click on table like in the attached picture :

Ritaf1983_2-1726890115298.png

Create 2 measures :
1.

Sum_Exclude_personas = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Category]<>"Personas"))
Ritaf1983_3-1726890188883.png

2. 

Value_personas = CALCULATE(sum('Table'[Value]),FILTER(ALL('Table'[Category]),'Table'[Category]="Personas"))
3. Create the graph, note that categories should be on the Legend
Ritaf1983_4-1726890308598.png

4 Create a table, and filter out the personas.

Ritaf1983_5-1726890408892.png

5. Format the interactions with the graph :

Ritaf1983_6-1726890484788.png

Result:

Ritaf1983_7-1726890523803.png

After table selection 

Ritaf1983_8-1726890561423.png

 

If you want the line be hided too , apply all the same steps except of the measure for personas.
It should be :

Value_personas_2 = CALCULATE(sum('Table'[Value]),FILTER('Table','Table'[Category]="Personas"))
The result will be :
Ritaf1983_9-1726890667181.png

 

A more detailed guide about unpivot here :
https://www.youtube.com/watch?v=tAIqopmj9RA

And about editing interactions here :
https://www.youtube.com/watch?v=5MteQv_h6ck

The pbix with the solutions is attached

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Hi @Ritaf1983 ,

It is great! Thx a lot!!

View solution in original post

6 REPLIES 6
Fh3r1008
Frequent Visitor

Hi @Ritaf1983 

Thx a lot! Let me check it 

Hi @Ritaf1983 ,

It is great! Thx a lot!!

Happy to help 🙂

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi all - @Ritaf1983,

I have another situation with this same case. We need to do a change and maybe you can help us.

I used the option 1 of your solution (keep show the line) but now we need this:

When we apply some filter, for example "Recibo", we need to show the "Recibo" bar (this is ok) but also we need to have a change in the line, I mean, the line should show only the value of persons for Recibo process.

Let me explain more, this is my table:

 

PBI3.jpg

I mean, the 9 result is the sum of 3 different numbers. Red rectangle has the formula for calculate the persons for Recibo process, orangle rectangle for calculate persons for Reempaque process and green rectangle for Embarque process.

So, the change that we need is, for example, if I select the filter for Recibo... the bar now changes correctly but the line needs to change too with the value ONLY of the persons for recibo process (calculate with red rectangle formula).

 

At the row with red arrow we see the example... with that data, persons for Recibo is 1, for Reempaque 7 and for Embarque 1... sum 9.

 

Thanks in advance and I'll wait for your answer.

Hi @Fh3r1008 
I didn’t quite understand the logic of what you're trying to do, but Power BI doesn't recognize your formulas. If each component has a different number of personas, you need to load into Power BI 3 columns with the number of personas for each category separately. Then, during the unpivot stage, you’ll have both the categories and their corresponding number of personas in each row. This logic is essential when working with the tool to provide you with the flexibility and the ability to slice and filter the data correctly.

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

Hi @Fh3r1008 
To achieve a wanted interaction you can apply these steps.
1. From PQ you need to unpivot the table :

Ritaf1983_0-1726889986499.png

2. Close and apply

Ritaf1983_1-1726890019265.png

3 There is 2 scenarios 
3.1 if you want the line of personas to stay when you click on table like in the attached picture :

Ritaf1983_2-1726890115298.png

Create 2 measures :
1.

Sum_Exclude_personas = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Category]<>"Personas"))
Ritaf1983_3-1726890188883.png

2. 

Value_personas = CALCULATE(sum('Table'[Value]),FILTER(ALL('Table'[Category]),'Table'[Category]="Personas"))
3. Create the graph, note that categories should be on the Legend
Ritaf1983_4-1726890308598.png

4 Create a table, and filter out the personas.

Ritaf1983_5-1726890408892.png

5. Format the interactions with the graph :

Ritaf1983_6-1726890484788.png

Result:

Ritaf1983_7-1726890523803.png

After table selection 

Ritaf1983_8-1726890561423.png

 

If you want the line be hided too , apply all the same steps except of the measure for personas.
It should be :

Value_personas_2 = CALCULATE(sum('Table'[Value]),FILTER('Table','Table'[Category]="Personas"))
The result will be :
Ritaf1983_9-1726890667181.png

 

A more detailed guide about unpivot here :
https://www.youtube.com/watch?v=tAIqopmj9RA

And about editing interactions here :
https://www.youtube.com/watch?v=5MteQv_h6ck

The pbix with the solutions is attached

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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