Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
akarasick1
Frequent Visitor

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!

1 ACCEPTED SOLUTION

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.

 

using1.jpg

 

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.

View solution in original post

4 REPLIES 4
BIlearner0
Frequent Visitor

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? 

 

v-zhenbw-msft
Community Support
Community 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")

 

USing1`.jpg

 

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)

 

using2.jpg

 

using3.jpg

using4.jpg

 

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.

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!

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.

 

using1.jpg

 

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.