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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
stoss
Frequent Visitor

Filter with 2 columns

Hello,

 

I would like to make a filter in one "recipient" column and filter also the identical values present in "MessageTracId" column.

 

If I make a filter in "recipient" column with => Not Contains  "Test1"
All the rows with MessageTracId "12" should be filtered.

 

Source.Name_timesenderrecipientMessageTraceId
1119_o365.csv30/11/2019BobTest112
1119_o365.csv30/11/2019BobTest212
1119_o365.csv30/11/2019BobTest312
1119_o365.csv30/11/2019BobTest412
1119_o365.csv30/11/2019BobTest513
1119_o365.csv30/11/2019BobTest613
1119_o365.csv30/11/2019BobTest713

 

Thank you very much for your help.

1 ACCEPTED SOLUTION

hi @stoss 

Just adjust the formula as below:

New Measure = VAR __rec = SELECTEDVALUE ( message[recipient] )
VAR __id = SELECTEDVALUE(message[MessageTraceId]) 
VAR __cc = CALCULATE( COUNTROWS( message ), ALLSELECTED( message[recipient] ), message[MessageTraceId] = __id )
VAR __cx =  CALCULATE(COUNTROWS( message ),ALL(message),message[MessageTraceId]=__id)
RETURN IF ( __cc = __cx, __cx, 0 )

Then use it as visula level filter:

1.JPG

 

Regards,

Lin

Community Support Team _ Lin
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

15 REPLIES 15
parry2k
Super User
Super User

@stoss not sure if I understood your request, you can add two slicer and choose recipient and messagetraceid as slicer column and once you choose value from recipient, it will filter 2nd slicer and vice versa



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

stoss
Frequent Visitor

Thank for you answer, I will explain you my need.

In the below example, i want to count how many messages Bob sent to internal recipient ONLY.

 

_timesenderrecipientMessageTraceId
30/11/2019Bobinternal12
30/11/2019Bobexternal12
30/11/2019Bobinternal13
30/11/2019Bobinternal13


So if I make a filter with "internal", I will see 2 messages ID (12 & 13), but I want to count just when there are only "internal" recipients.

The result should be :

 

_timesenderrecipientMessageTraceId
30/11/2019Bobinternal13
30/11/2019Bobinternal13

@stoss what it the logic to exclude 12 when you selected internal?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

stoss
Frequent Visitor

@parry2k  because the messageId "12" contains a row with "external" recipient.

I need to count  MessageID with only "internal" value in "recipient" column.

 

As MessageId "12" is also associated to a row containing "external" value, I have to exclude it even if we have rows with "internal".

 

 

@stoss solution attached, look at message table and page 4, there is other stuff in attached file, ignore that.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

stoss
Frequent Visitor

@parry2k  wow thank's a lot for your help.

I'm still trying to reproduce it in my PBIX 😞 

Good luck and don’t hesitate to reach out in case you run into an issue.


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

stoss
Frequent Visitor

@parry2k  I put my private data into your pbix and it doesn't work like excpected 😞

 

@stoss that's not good. share sample data in pbix file and I will take a look. I probably missed something and doesn't have full picture on how your data looks like.

 

Removing sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

stoss
Frequent Visitor

@parry2k you will find the pbix in the below link.

https://drive.google.com/file/d/153NtCOuGPQLGiUmJY8XsfVLmkO88FnKi/view?usp=sharing

The goal is to count only messages with gmail.com and/or yahoo.com.

The result should be 3, with following IDs :
123-456
456-789
252-973

stoss
Frequent Visitor

@parry2k you will find the pbix in the link below.

https://drive.google.com/file/d/153NtCOuGPQLGiUmJY8XsfVLmkO88FnKi/view?usp=sharing

The goal is to count only messages with gmail.com and/or yahoo.com.

The result should be 3, with following IDs :
123-456
456-789
252-973

hi @stoss 

Just adjust the formula as below:

New Measure = VAR __rec = SELECTEDVALUE ( message[recipient] )
VAR __id = SELECTEDVALUE(message[MessageTraceId]) 
VAR __cc = CALCULATE( COUNTROWS( message ), ALLSELECTED( message[recipient] ), message[MessageTraceId] = __id )
VAR __cx =  CALCULATE(COUNTROWS( message ),ALL(message),message[MessageTraceId]=__id)
RETURN IF ( __cc = __cx, __cx, 0 )

Then use it as visula level filter:

1.JPG

 

Regards,

Lin

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

@v-lili6-msft Thank you for you help. Looks better now

As there is "MessageTraceId" present in the table, I can't count per month on one line.

 

table.JPG

When I remove "MessageTraceId", the table becomes empty.
I would like a table like that :

2019  December    3

Many thanks again @v-lili6-msft  and @parry2k for you help.

HI @stoss 

For the row context of the visual has changed, the [New Measure] has been changed too.

So for your case, just add a new measure

Count MessageTraceld 
= VAR _TABLE=ADDCOLUMNS(SUMMARIZE(message,message[_time],message[MessageTraceId]),"_A",[New Measure]) RETURN
COUNTAX(FILTER(_TABLE,[_A]>=1),[MessageTraceId])

and remove the visual level filter of this table visual.

5.JPG

 

Regards,

Lin

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

It works, thank you very much @v-lili6-msft  and @parry2k 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.