Forum Discussion

AkhilReddyN's avatar
AkhilReddyN
Frequent Visitor
2 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 ...
  • 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