Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

slicer with yes and No

i have the data as below   id    type 1     fruit 2     vegetable 3     fruit 4     fruit 5     vegetable   i am looking for slicer filter with display yes and no option.  Yes - all records...
  • v-juanli-msft's avatar
    6 years ago

    Hi Anonymous 

    You can create a measure and add it to visual level filter as below:

     

    if show = IF(SELECTEDVALUE('slicer table'[slicer])="yes",1,IF(MAX('Table'[ type])<>"vegetable",1))

     

    Or create measures and add it the column chart

    Measure =
    SWITCH (
        MAX ( 'new table'[slicer] ),
        "no", CALCULATE (
            DISTINCTCOUNT ( 'Table'[id] ),
            FILTER (
                'Table',
                'Table'[ type] <> "vegetable"
            )
        ),
        "yes", DISTINCTCOUNT ( 'Table'[id] )
    )
    

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.