Forum Discussion

margaridatedim's avatar
margaridatedim
Frequent Visitor
1 year ago
Solved

Auto-Reset Slicer Selection When Changing Selection in Main slycer

I have two attributes in my report: "Sales Groups" and "Sales Types," with a one-to-many relationship between them. Each "Sales Type" belongs to a single "Sales Group," while one "Sales Group" can have multiple "Sales Types." On the same report page, I use two single-select slicers—one for "Sales Groups" and one for "Sales Types."

The functionality works so that when I select a specific "Sales Group," only the corresponding "Sales Types" are shown in the second slicer. However, I'm encountering an issue: when I switch between different "Sales Groups," the "Sales Types" slicer remains stuck on the previously selected type from the first group.

What I'd like to achieve is for the "Sales Types" slicer to automatically select the first available option whenever I change the "Sales Group," instead of keeping the previous selection.

Can anyone help with a solution for this?

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi margaridatedim ,

     

    You can try formula like below:

     

    FirstSalesType = 
    CALCULATE(
        FIRSTNONBLANK('Sales Types'[Types], 1),
        FILTER(
            'Sales Types',
            'Sales Types'[Group] = SELECTEDVALUE('Sales Groups'[Group])
        )
    )
    SelectedSalesType = 
    IF(
        ISFILTERED('Sales Types'[Types]),
        SELECTEDVALUE('Sales Types'[Types]),
        [FirstSalesType]
    )

     


    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi margaridatedim ,

     

    Choose  SelectedSalesType to Filters on this visual. You can check pbix file i have provided.

    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • Power BI doesn't automatically clear slicer selections between interactions by default.

    You can use Clear all slicers to reset the slicers every time.

     

    If this helped, a Kudos 👍 or Solution mark would be great! 🎉
    Cheers,
    Kedar
    Connect on LinkedIn

  • margaridatedim's avatar
    margaridatedim
    Frequent Visitor

    Hello, 

    thank you for your response. 

    I don't want to clear the slicers. I want it to automatically change between selections when in the "main" slicer I change my selection. So for example, when I choose "Web" in Sales Groups I want it in Sales Types to choose "AliExpress" (first row in this category) and then I choose "Store" in the Sales Groups that it automatically change to "Alasca" in the Sales Types and it's not doing that it gets "stuck" in "AliExpress" eventhough this category doesn't even exist for the "Store" group so my dashboard is all blank. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi margaridatedim ,

     

    You can try formula like below:

     

    FirstSalesType = 
    CALCULATE(
        FIRSTNONBLANK('Sales Types'[Types], 1),
        FILTER(
            'Sales Types',
            'Sales Types'[Group] = SELECTEDVALUE('Sales Groups'[Group])
        )
    )
    SelectedSalesType = 
    IF(
        ISFILTERED('Sales Types'[Types]),
        SELECTEDVALUE('Sales Types'[Types]),
        [FirstSalesType]
    )

     


    Best Regards,
    Adamk Kong

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi margaridatedim ,

         

        Choose  SelectedSalesType to Filters on this visual. You can check pbix file i have provided.

        Best Regards,
        Adamk Kong

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.