Forum Discussion

akarasick1's avatar
akarasick1
Frequent Visitor
6 years ago
Solved

Using OR Logic on 2+ Slicers to Populate Scatter Chart

I am looking for a way to make selections from 2 slicers to populate a scatter chart by utilizing OR logic, not AND logic.

 

Slicer A (Store List, Active stores)

Store 1

Store 2

Store 4

 

Slicer B (Store List, Inactive stores)

Store 3

Store 5

 

If I were to select Store 1 from Slicer A and Store 3 from Slicer B, I would want to see 2 dots on my Scatter Chart (their X/Y coordinates). I've simplified the scenario here and do need two separate slicers.

 

Please let me know what approach you would take. Thank you!

  • Hi akarasick1 ,

     

    We can use VALUES function not use SELECTEDVALUE function to meet your requirement. The new measure like this,

     

    Measure = 
    var _select_SlicerA = VALUES('Slicer A'[Store List])
    var _select_SlicerB = VALUES('Slicer B'[Store List])
    return
    IF(MAX('Table'[Store List]) in _select_SlicerA||MAX('Table'[Store List]) in _select_SlicerB,1,0)

     

    The remaining steps are the same as before.

     

     

    If you have any question, please kindly ask here and we will try to resolve it.

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

4 Replies

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Icon for Community Support rankCommunity Support

    Hi akarasick1 ,

     

    You can create two tables, one contains active store, another contains inactive store. And create a slicer based on them.

    Then you can refer the following steps based on our sample.

     

    1. Create two tables to be slicer.

     

    Slicer A = CALCULATETABLE(DISTINCT('Table'[Store List]),'Table'[State]="Active stores")
    Slicer B = CALCULATETABLE(DISTINCT('Table'[Store List]),'Table'[State]="Inactive stores")

     

     

    2. Then we can create a measure and put it in Filter on this visual.

     

    Measure = 
    var _select_SlicerA = SELECTEDVALUE('Slicer A'[Store List])
    var _select_SlicerB = SELECTEDVALUE('Slicer B'[Store List])
    return
    IF(MAX('Table'[Store List])=_select_SlicerA||MAX('Table'[Store List])=_select_SlicerB,1,0)

     

     

     

    If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

    It will be helpful if you can show us the exact expected result based on the tables.

     

    Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

    BTW, pbix as attached.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

    • akarasick1's avatar
      akarasick1
      Frequent Visitor

      This looks great! How would I amend this to be able to handle multiple selections within the slicer - right now it only works with one selection.

       

      Thank you!

      • v-zhenbw-msft's avatar
        v-zhenbw-msft
        Icon for Community Support rankCommunity Support

        Hi akarasick1 ,

         

        We can use VALUES function not use SELECTEDVALUE function to meet your requirement. The new measure like this,

         

        Measure = 
        var _select_SlicerA = VALUES('Slicer A'[Store List])
        var _select_SlicerB = VALUES('Slicer B'[Store List])
        return
        IF(MAX('Table'[Store List]) in _select_SlicerA||MAX('Table'[Store List]) in _select_SlicerB,1,0)

         

        The remaining steps are the same as before.

         

         

        If you have any question, please kindly ask here and we will try to resolve it.

        BTW, pbix as attached.

         

        Best regards,

         

        Community Support Team _ zhenbw

        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, @v-zhenbw-msft, akarasick1  If one of the slicers is coming from a table with an inactive relationship then how would you modify the DAX?