cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors