Forum Discussion

AkhilReddyN's avatar
AkhilReddyN
Frequent Visitor
3 years ago
Solved

How to get default slicer value for second slicer?

Hello Power BI Community,

 

I am working on a report where cascading filters play a crucial role. My report structure is such that the selection in one slicer dictates the options available in the subsequent slicer.

Here's my scenario:
1. I have a **Sports** slicer where users select a cricket, football, batting...
2. Based on the selected Sports, a second slicer populates with specific Phase (e.g., if cricket is chosen, the second slicer may offer average, medium, and speed).
3. For this second slicer, I want medium to be selected by default unless the user manually chooses a different sport.
4. Further, based on the selection in the second slicer, if i select cricket in slicer1 (sports) and average is selected on slicer2 (phase) now if i select batting it should directly get default as medium (Note : As batting only has the medium field). While I've managed to set up the cascading slicers, my main challenge is setting a default value for the second slicer. Please check the attached images. Is it possible to directly set default slicer values in Power BI? Any guidance or workarounds would be highly appreciated.

 

In the below image1 i have selected cricket in slicer1 and average in slicer2

 

 

In the below image2 i have selected batting, but here i should get default as medium, as there is only medium present in batting

In the image3 there is only medium present in batting column

Thank you in advance!

Please find the below PBIX file for reference

default slicer.pbix

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  AkhilReddyN ,

     

    Here are the steps you can follow:

    For the slicer that comes with Power BI, we can not get it. But we can get the three point in the "Visualizations", and we click the "Get more visual":

     

    Then we find the "Preselected Slicer" and add the visual to our Power Bi Desktop.

    First , we need to create a table with one column , and the value is True and False, like this:

    Second, we can create a measure to define that we need default preselection values. If we need default preselection then we return True, otherwise we return False.

    Measure =
    var _select=SELECTEDVALUE('Table'[Column1])
    var _step=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Column1]=_select),"Column2",'Table'[Column2])
    return
    SWITCH(
        TRUE(),
        _select="cricket"&&MAX('Table'[Column2])="average",TRUE(),
            ISFILTERED('Table'[Column1])=TRUE()&&MAX('Table'[Column2]) in _step&&_select<>"cricket",TRUE(),         
        ISFILTERED('Table'[Column1]) =FALSE()&&MAX('Table'[Column2]) ="medium",TRUE()
    )

    Then we can put the 'Table'[Column2] in the Fields , [Measure] in the Pre Selection , 'Dirty Table'[Dirty Status] in the Dirty Status, like below screenshot:

    Result:

     

     

    Best Regards,

    Liu Yang

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

3 Replies

  • hi AkhilReddyN 

    you should use edit interactions in format tab for making a filter interact the other but as I know there is no way to make automatic selection in slicers (their nature is to be selected by user)

    • AkhilReddyN's avatar
      AkhilReddyN
      Frequent Visitor

      Hi ShirinArshadnia 

      Firstly thanks for your responce, is there any other way  possible without using edit interactions. A different way would be helpful in my case.

       

      Thank you

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  AkhilReddyN ,

     

    Here are the steps you can follow:

    For the slicer that comes with Power BI, we can not get it. But we can get the three point in the "Visualizations", and we click the "Get more visual":

     

    Then we find the "Preselected Slicer" and add the visual to our Power Bi Desktop.

    First , we need to create a table with one column , and the value is True and False, like this:

    Second, we can create a measure to define that we need default preselection values. If we need default preselection then we return True, otherwise we return False.

    Measure =
    var _select=SELECTEDVALUE('Table'[Column1])
    var _step=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Column1]=_select),"Column2",'Table'[Column2])
    return
    SWITCH(
        TRUE(),
        _select="cricket"&&MAX('Table'[Column2])="average",TRUE(),
            ISFILTERED('Table'[Column1])=TRUE()&&MAX('Table'[Column2]) in _step&&_select<>"cricket",TRUE(),         
        ISFILTERED('Table'[Column1]) =FALSE()&&MAX('Table'[Column2]) ="medium",TRUE()
    )

    Then we can put the 'Table'[Column2] in the Fields , [Measure] in the Pre Selection , 'Dirty Table'[Dirty Status] in the Dirty Status, like below screenshot:

    Result:

     

     

    Best Regards,

    Liu Yang

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