Forum Discussion

nitinsu's avatar
nitinsu
Regular Visitor
7 years ago
Solved

Slicer filtering

HI,

 

I have data as in the below example

 

Col1Col2Col3
AllData11
XYZData12
ABCData13
AllData24
AllData25

 

I have a slicer that maps to Col1 above and a graph control that shows the values of col3 on a line chart (have not shown the datetime in the above sample).

 

As in the data above, for Col2=Data1 the Col1 values are 'All' along with other values, whereas for Col2=Data2 the Col1 values is always 'All'. I wanted to default show the Col1='All' values on the graph even when the user selects any other values from the Col1 slicer in the UI i.e. if "ABC" is selected then the Data1 should be filtered for Col1="ABC" but Data2 should be filtered for "All".

 

Is this possible, any help on how this can be achieved?

  • Hi nitinsu 

    Create a new table

    Table new = Table1

    Add [Col1] from "Table new" in the slicer.

     

    Create meausres in Table1

    SELECTED_Col1 = SELECTEDVALUE('Table new'[Col1])
    
    SELECTED_Col2 = SELECTEDVALUE('Table new'[Col2])
    
    flag =
    IF (
        [SELECTED_Col1] = "ALL",
        IF ( [SELECTED_Col1] = MAX ( Table1[Col1] ), 1, 0 ),
        IF (
            MAX ( Table1[Col2] ) = "DATA2",
            1,
            IF ( [SELECTED_Col1] = MAX ( Table1[Col1] ), 1 )
        )
    )
    
    value = SUM(Table1[Col3])
    

    Add [flag] in the viusal level filter as below

    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.

1 Reply

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

    Hi nitinsu 

    Create a new table

    Table new = Table1

    Add [Col1] from "Table new" in the slicer.

     

    Create meausres in Table1

    SELECTED_Col1 = SELECTEDVALUE('Table new'[Col1])
    
    SELECTED_Col2 = SELECTEDVALUE('Table new'[Col2])
    
    flag =
    IF (
        [SELECTED_Col1] = "ALL",
        IF ( [SELECTED_Col1] = MAX ( Table1[Col1] ), 1, 0 ),
        IF (
            MAX ( Table1[Col2] ) = "DATA2",
            1,
            IF ( [SELECTED_Col1] = MAX ( Table1[Col1] ), 1 )
        )
    )
    
    value = SUM(Table1[Col3])
    

    Add [flag] in the viusal level filter as below

    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.