Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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.

  • Anonymous's avatar
    Anonymous
    7 years ago

    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

     

    And here is the pbi file.

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

     

    Hope this helps, Goodluck.

5 Replies

  • v-xicai's avatar
    v-xicai
    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's avatar
      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's avatar
        Anonymous
        Not applicable

        Fixed picture, will look into request now.