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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MAAMI
Regular Visitor

Filter two columns with an "or" condition

I have created the table below, as an example of a part of my query. My query is a combination of several reports / excel-sheets, which include transactions with a sender name and a receiver name.

I want to create a slicer filter showing all sender+receiver locations, where if I in example choose to filter by "New York", it will show all rows where "New York" is mentioned either as sender or receiver. So in this example, it should show row numbers: 1, 2 and 8. How can I develop such a slicer filter?

 

Row numberReport numberSenderReceiver
11New YorkBerlin
21BeijingNew York
31ParisBerlin
42Los AngelesMadrid
52Los AngelesBerlin
63TokyoMadrid
74DubaiCopenhagen
84New YorkBeijing
94BerlinParis

 

 

1 ACCEPTED SOLUTION
niteshtrehan89
Helper III
Helper III

Hi Maami,

 

First step is to create a calculated column in the table to combine the sender and receiver values.

 

SenderReceiver = COMBINEVALUES ( "|", Slicer[Sender], Slicer[Receiver] )
 
Then create the table with the below measure.
 
slicer test = DISTINCT(UNION(SELECTCOLUMNS(Slicer,"selection",Slicer[Sender],"both",Slicer[SenderReceiver]),
SELECTCOLUMNS(Slicer,"selection",Slicer[Receiver],"both",Slicer[SenderReceiver])))
 
Once the table is created, create a many to many cardinality and single filter direction between the table and slicer test table on senderreceiver and both columns.
 
Slicer.PNG
Slicer result.PNG

View solution in original post

3 REPLIES 3
niteshtrehan89
Helper III
Helper III

Hi Maami,

 

First step is to create a calculated column in the table to combine the sender and receiver values.

 

SenderReceiver = COMBINEVALUES ( "|", Slicer[Sender], Slicer[Receiver] )
 
Then create the table with the below measure.
 
slicer test = DISTINCT(UNION(SELECTCOLUMNS(Slicer,"selection",Slicer[Sender],"both",Slicer[SenderReceiver]),
SELECTCOLUMNS(Slicer,"selection",Slicer[Receiver],"both",Slicer[SenderReceiver])))
 
Once the table is created, create a many to many cardinality and single filter direction between the table and slicer test table on senderreceiver and both columns.
 
Slicer.PNG
Slicer result.PNG

This worked like a charm, thanks!

amitchandak
Super User
Super User

create a slicer that did not join to this table

And use this measure in you table of matrix

 

measure =
var _max = maxx(Slicer,Slicer[city]) // values(Slicer[city])
return
calculate(countrows(table),filter(table,table[Sender]=_max || table[Receiver]=_max))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.