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

Control 1 Visual with 2 slicers

Hello, I am trying to control 1 Visual with 2 slicers. The first one controls the companies(x axis) that appear on the Stacked Column Chart. The second controls objects that are in the stacks(y axis).  Got the first slicer working fine so I can control what companies appear in the chart but the second one always seems to just return true when I check if it's returning. 

 

Table = ADDCOLUMNS(SumOfErrors,"NICKTEST",CALCULATE
	  (
		SUMX(SumOfErrors,
IF(CONTAINS
	(ALLSELECTED(Errors[ErrorType]),Errors[ErrorType],"OT"),(VALUE([P_OT])),0)
+//Adds the next term to run through SUMX
IF(CONTAINS
	(ALLSELECTED
	(Errors[ErrorType])
	,Errors[ErrorType],"UT")
,(VALUE([P_UT])),0)

),


      FILTER(ALLSELECTED(SumOfErrors[VENDOR_NAME]), SumOfErrors[P_UT] IN VALUES(SumOfErrors[P_UT]))))

The Errors Table is just 1 column with a bunch of rows that contain error codes such as "OT". This is what provides options to the second slicer. 

 

What I was trying to do was

1. Grab the list selected rows from Slicer 2.   

2. Run that through an SUMX with a bunch of if statements to see if it contained an error code.(1 code at a time)

3. Use that to populate my graphs.

 

If anyone has a clue what I have done wrong it would be much appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

In edit queries select UT, OT, BT and CT and click unpivot columns. You now get Attribute and Value. Then create a relationship between Attribute and Errortype and the slicers should work. 

 

Screenshots below

pivot.pngrela.png

 

And here is the pbi file.

https://1drv.ms/u/s!AgnVgd15_ye0hBnpo-dpJlRKyYpc

 

Hope this helps, Goodluck.

View solution in original post

5 REPLIES 5
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

I am not sure what desired result would you want, could you please share your sample data or desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

Anonymous
Not applicable

Hey @v-xicai 

So the Table SumOfErrors Looks something like this:

Sample Data Table

This is the Errors table I am trying to use a slicer:

Errors

And using this data I am trying to build visuals in Power Bi but I would like to be able to choose the vendors being show and select the Error type shown. For example I would like to select company1 and 3 but only show errors UT and CT. My problem is that I am unsure how I would select column using a slicer.

Let me know if this makes things anymore clear. 

 

Thanks

Anonymous
Not applicable

Fixed picture, will look into request now.

 

SampleData1.PNG

Anonymous
Not applicable

Hi,

 

In edit queries select UT, OT, BT and CT and click unpivot columns. You now get Attribute and Value. Then create a relationship between Attribute and Errortype and the slicers should work. 

 

Screenshots below

pivot.pngrela.png

 

And here is the pbi file.

https://1drv.ms/u/s!AgnVgd15_ye0hBnpo-dpJlRKyYpc

 

Hope this helps, Goodluck.

Anonymous
Not applicable

@Anonymous 

You are a champion sir, I spent hours trying to do it my way but this works much better.

Thanks

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.