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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to filter and count rows that contains a value in another column.

I have the a table called attck_table:

 

attck_table
Attack NameProtocolAction
Attack 1http,citrixBlocked
Attack 2http,oracleBlocked
Attack 3ipv4, dnsBlocked
Attack 4citrixBlocked
Attack 5ircBlocked
Attack 6ipv4,http,citrixBlocked
Attack 7dnsBlocked
Attack 8imap,smtpBlocked
Attack 9httpBlocked
Attack 10netbios-ssBlocked
Attack 11http,ssl,citrixBlocked

 

I already created another table with pre-defined attack name values (manualy) and then I ve created an DAX Function for the "Total" Colum. The DAX Function is exactly that:

 

total =
CALCULATE(COUNTA(attck_table[Column1.protocol]),FILTER(ALL(attck_table),attck_table[Column1.protocol]='desired_table'[protocol]))

 

It is reasonably working, but the problem is that it is bring it just the columns that have the exact value, and as you can see, we have "comma" with more values.

 

desired_table
ProtocolTotal
http1
citrix1
oracle0
ipv40
irc1
dns1
imap0
smtp0
netbios-ss1
ssl0

 

What I want is to use something like "contain", "match", "like" or may be, use some wildcard to bring me all rows that have the value. Here the desired result:

 

desired_table
ProtocolTotal
http5
citrix4
oracle1
ipv42
irc1
dns2
imap1
smtp1
netbios-ss1
ssl1

 

I know that I can work also with variables poiting to 'desired_table'[Protocols] , but I got the same problem:

Do you guys have any idea?

 

Thank you so much.

Lucas

 

1 REPLY 1
Greg_Deckler
Super User
Super User

In Query Editor, split your Protocol column. Unpivot the resulting columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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