Forum Discussion

rehansaeed2468's avatar
7 months ago

Slicer Selection WIth Filtered Data

I have 2 products A and B and each have ratings from 0-3.0.  Need to create 2 seperate Slicers with Ratings. One Slicer for Product A and anotehr one for Product B. Requirement is that I should be able to select for example 0.0 and 1.3 from Slicer A and 2.3 and 2.9 from Slicer B.  

 

Is it possible in Power BI

 

Please see the below desired Output

 

Link to Sample Data:

https://docs.google.com/spreadsheets/d/1Dj1_xDYJA9bb8tFQp0i2LmarEVIZrYip/edit?usp=sharing&ouid=101847980207356827043&rtpof=true&sd=true

 

Link to Sample output:

https://drive.google.com/file/d/1xaAkrvCNqix9e82nrk9C48X5jUCKMC1y/view?usp=sharing

7 Replies

  • Hey rehansaeed2468 ,

     

    From the expected output screenshot, I am making an assumption that the Ratings will be at the stops of 0.0, 1.3, 1.9, 2.3 and 2.9 (if it is a continuous value, then you might want to go ahead with numeric range parameters). Anyway, the following is the setup with two disconnected tables (one for product A rating and other for product B rating) for slicers and one additional table to show the filtering work:

    ProductRatingA = 
    DATATABLE(
        "Product", STRING,
        "Rating", STRING,
        {
            {"A", "0.0"},
            {"A", "1.3"},
            {"A", "1.9"},
            {"A", "2.3"},
            {"A", "2.9"}
        }
    )
    ProductRatingB = 
    DATATABLE(
        "Product", STRING,
        "Rating", STRING,
        {
            {"B", "0.0"},
            {"B", "1.3"},
            {"B", "1.9"},
            {"B", "2.3"},
            {"B", "2.9"}
        }
    )
    ProductDim = 
    DATATABLE(
        "Product", STRING,
        "Rating", STRING,
        "ProductName", STRING,
        "Description", STRING,
        "UnitPrice", CURRENCY,
        {
            {"A", "0.0", "Product A - Rating 0.0", "Entry-level product with basic features", 10.00},
            {"A", "1.3", "Product A - Rating 1.3", "Standard product with essential features", 15.50},
            {"A", "1.9", "Product A - Rating 1.9", "Enhanced product with advanced features", 22.75},
            {"A", "2.3", "Product A - Rating 2.3", "Premium product with superior quality", 29.99},
            {"A", "2.9", "Product A - Rating 2.9", "Top-tier product with all features", 39.99},
            {"B", "0.0", "Product B - Rating 0.0", "Entry-level product with basic features", 12.00},
            {"B", "1.3", "Product B - Rating 1.3", "Standard product with essential features", 18.50},
            {"B", "1.9", "Product B - Rating 1.9", "Enhanced product with advanced features", 25.75},
            {"B", "2.3", "Product B - Rating 2.3", "Premium product with superior quality", 32.99},
            {"B", "2.9", "Product B - Rating 2.9", "Top-tier product with all features", 44.99}
        }
    )

    And for the filter, we will create a measure that acts as visual level filter:

    FilterProducts = 
    VAR SelectedRatingsA = VALUES(ProductRatingA[Rating])
    VAR SelectedRatingsB = VALUES(ProductRatingB[Rating])
    VAR CurrentProduct = SELECTEDVALUE(ProductDim[Product])
    VAR CurrentRating = SELECTEDVALUE(ProductDim[Rating])
    
    RETURN
    IF(
        (CurrentProduct = "A" && CurrentRating IN SelectedRatingsA) ||
        (CurrentProduct = "B" && CurrentRating IN SelectedRatingsB),
        1,
        0
    )

    Drag this measure to the filter pane under Filters on this visual (for the visual you want, table will be used as example) and set it to check if it is equal to 1: 

    Then you should have something like this:

    Make changes as necessary.

    Hope it helps!

      • v-veshwara-msft's avatar
        v-veshwara-msft
        Community Support

        Hi rehansaeed2468 ,

        Thanks for reaching out to Microsoft Fabric Community.

        Thanks alish_b for sharing the approach.

        I recreated the same setup and verified the behavior against the expected output. The two rating slicers work independently for Product A and Product B, and the table reflects the combined selections correctly.

         

        Attaching a working PBIX for reference.

         

        Hope this helps. Please reach out for further assistance.
        Thank you.

  • Hey rehansaeed2468 ,

    the simplest way I can think of:

    Create two slicers, add the product column as a filter to the visual level in the filter pane, and filter accordingly.
    It's important that you edit the interactions for the visuals (the slicers) to make them independent.
    Of course, this also requires duplicating all other data visualizations, because it's not possible to filter a bar chart (or any other visual) using two different slicers based on the same table.

    Hopefully, this helps to tackle your challenge.

    Regards,

    Tom

  • Hi rehansaeed2468 ,

     

    Just checking in to see if you query is resolved and if any responses were helpful.
    Otherwise, feel free to reach out for further assistance.

     

    Thank you.