Forum Discussion

AbdulAzad's avatar
AbdulAzad
Frequent Visitor
7 years ago
Solved

Dynamically Add or Remove Dimension or attributes to a table visual using a slicer selection

Hi, I am pretty new to Power BI, I wanted to show and hide columns in a table visual based on slicer selection, columns are like Effective_Date, Purchase_Date, Quantity, Order_Number. How can I achieve this. I have seen so many videos of show/hide columns on measures not on dimension or attribute or date columns. Your help on this will be much appreciated. Thanks & Regards, A
  • AbdulAzad's avatar
    AbdulAzad
    7 years ago

    Hi Jimmy,

     

    It didn't solve to the extent I expected, because I wanted even dimensions to be shown and hidden based on slicer selection, the solution provided will not work, if I try to pivot my table on huge volumes of data. Where I used the DAX expressions to hide and display only measures not the dimensions at this point of time.

     

    Thanks & Regards,

    Abdul

8 Replies

    • AbdulAzad's avatar
      AbdulAzad
      Frequent Visitor
      Hi Jimmy, Thank you very much for your reply. Bookmarks doesn't work out for my requirement. My requirement is I have a table visual which has number of columns, out of which I wanted to provide user the option to show or hide few columns based on user selection in a multi select check box slicer. By default all columns are displayed as default. Based on the user selection I want to hide or show only the selected columns. I used the concept of power-pivot which doesn't suit my requirement where my data might be huge and in power-pivot I have only the option to separate measures and dimensions differently, which is not what I wanted ,I hope you understood my requirement. Thanks & Regards, A
  • itsmebvk's avatar
    itsmebvk
    Continued Contributor

    Please see the attached PBIX .

     

    Follow these steps:

     

    1) Import data in to Power BI I am using excel as source

    2) Then you need to insert index column on Query 1 (if you don't have any key column)

    3) Then you need to duplicate your Query1 as Query2

    4) Then remove unnecessary columns from Query2 except the columns you want in slicer and Index column. In this example I have used Plant,Turbine, Index

    5) Then select Plant and Turbine column in Query 2>Right Click>Unpivot

    6) Now you will see new column names as Attribute and Values in Query2

    7) Now use Query 2 Attribute column as slicer

    8) Add a bar chart to the report then add Value from Query2 to Bar chart

    9) Add other measures or dimensions from Query1 to chart

    10) Now you should be able to switch dimensions using slicer, but if you observe data is showing incorrectly on charts, this is because of Cross Filter Direction set to SIngle

     

     

     

     

     

    11) You can fix this issue by changing cross filter direction to both or creating new measure using following code

     

    Calculated Alarrm Count = CALCULATE(SUM('Query1'[Alarm_Count]),CROSSFILTER(Query2[Index],'Query1'[Index],Both))


    I strongly suggest you to do it using Calculated Measure or instead of changing Join

     

    12) Now add newly created measure to the report , it should display data as expected.

     

     

    Please see the attached PBIX .

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, did you ever found a solution?

     

    I am interested in doing something similar to this.

     

    Thanks