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
mrfsca
Frequent Visitor

Trouble creating slicers for stacked bar chart from across the table

Hello, I'm having trouble creating a line and stacked bar chart. Here's the scenario: I have three tables with some common columns, and each table has an "LP" column indicating the location of the data. The LP columns in the tables contain BR, LR, and LB, respectively. My goal is to use these three columns as slicers. I found a suggestion in the Power BI community, which is:

Plant = DISTINCT(UNION(SELECTCOLUMNS('BR',"LP",'BR'[LP]),SELECTCOLUMNS('LR',"LP",'LR'[LP]),SELECTCOLUMNS('LB',"LP",'LB'[LP])))

However, I'm not sure how to apply this as a slicer because when I try it, there are no changes in the chart. Additionally, I want to create another slicer where users can select which variables to include in the stacked bar chart. Specifically, I have four variables: cost A, cost B, cost C, and cost D, which contain numerical values. Should I insert those fields from each tables in the column y axis to get what I want? The chart should only display the values for a single plant. Please provide suggestions so that I can achieve my desired outcome. Thanks in advance

mrfsca_1-1687671610874.png 

mrfsca_2-1687671746064.png

 

 

 

 

 

1 ACCEPTED SOLUTION
rbriga
Impactful Individual
Impactful Individual

Regarding costs

Unpivot the table- either at the source, or in the Query Editor:

1. Right click the table, then Edit query

2. Select your costs columns 

3. Follow this example

Now you have a dimension (Costs) which you can use as a slicer.

Unpivot costsUnpivot costsVictory!Victory!

I admit that I don't understand the LP table(s) just yet.

Perhaps I'd need the dataset itself to help further.

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!

View solution in original post

4 REPLIES 4
rbriga
Impactful Individual
Impactful Individual

Regarding costs

Unpivot the table- either at the source, or in the Query Editor:

1. Right click the table, then Edit query

2. Select your costs columns 

3. Follow this example

Now you have a dimension (Costs) which you can use as a slicer.

Unpivot costsUnpivot costsVictory!Victory!

I admit that I don't understand the LP table(s) just yet.

Perhaps I'd need the dataset itself to help further.

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!
mrfsca
Frequent Visitor

Thank you for resolving the issue I had. As for the LP table, it has been resolved by manually creating a combination table by merging the three tables together.

 

rbriga
Impactful Individual
Impactful Individual

Can you share the 2 tables structure with 3-4 rows of data each?

I suspect we would need to UNION these tables at the source with a column to seperate them into categories (BR, LR, and LB).

Then we will have 1 table to work with, and its colums will be functioning slicers.

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!
mrfsca
Frequent Visitor

Hello, this is the Cost A, B, C, D, and the LP preview table. Each table such as LR, BR, and LB has the same structure as this figure below. 

mrfsca_0-1687886170918.png 

mrfsca_2-1687886410022.png

 

 

 

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.