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
northward
New Member

Compare two tables and show the recidivists

Hello,

 

I would like to know how to compare two tables and present the results that are the same.

 

I have the following table structure:

"Host" "Vulnerability" "Port" "SO" "_time"

 

I need to compare to see if the lines are the same at different times.

 

I also have the files without being grouped, they follow the same structure ("Host" "Vulnerability" "Port" "OS" "_time"), but each month is in a different file.

 

Can someone please help me?

9 REPLIES 9
AlB
Super User
Super User

Hi @northward

 

Can you try explaining a bit more with a sample of your data and an example of what you need based on that sample?

For example, I have the following table: 

 

MonthCVEHostVulnerabilityPortProtocolSO
NovemberCVE-1999-010310.110.0.141Echo Service Detection7udpMicrosoft Windows 7 Professional
NovemberCVE-1999-010310.110.0.141Quote of the Day (QOTD) Service Detection17udpMicrosoft Windows 7 Professional
NovemberCVE-1999-050810.10.0.18PostgreSQL Default Unpassworded Account5432tcpLinux Kernel 3.10
Linux Kernel 3.5
Linux Kernel 3.8
Linux Kernel 3.9
NovemberCVE-1999-050810.10.0.22PostgreSQL Default Unpassworded Account5432tcpLinux Kernel 3.10
Linux Kernel 3.5
Linux Kernel 3.8
Linux Kernel 3.9
NovemberCVE-1999-051110.110.0.1IP Forwarding Enabled0tcpCISCO IOS 15
CISCO IOS 12
Cisco IOS XE
CISCO PIX
NovemberCVE-1999-051110.110.0.220IP Forwarding Enabled0tcpMac OS X 10.4
NovemberCVE-1999-051110.110.0.221IP Forwarding Enabled0tcpMac OS X 10.4
NovemberCVE-1999-051110.110.0.222IP Forwarding Enabled0tcpMac OS X 10.4
NovemberCVE-1999-051110.110.0.224IP Forwarding Enabled0tcpMac OS X 10.4
NovemberCVE-1999-051110.110.0.225IP Forwarding Enabled0tcpMac OS X 10.4
JanuaryCVE-1999-051110.110.0.227IP Forwarding Enabled0tcpMac OS X 10.4
JanuaryCVE-1999-051710.2.9.100SNMP Agent Default Community Name (public)161udpLantronix Universal Device Server UDS1100
JanuaryCVE-1999-051710.9.0.135SNMP Agent Default Community Name (public)161udpCISCO IOS 12.4(21)
JanuaryCVE-1999-0517192.168.1.6SNMP Agent Default Community Name (public)161udpLinux Kernel 2.6
JanuaryCVE-1999-0517192.168.2.6SNMP Agent Default Community Name (public)161udpLinux Kernel 2.6
JanuaryCVE-1999-051910.10.0.136Microsoft Windows SMB Shares Unprivileged Access445tcpLinux Kernel 3.10 on CentOS Linux release 7
JanuaryCVE-1999-051910.9.0.55Microsoft Windows SMB NULL Session Authentication445tcpMicrosoft Windows Server 2003 Service Pack 2
JanuaryCVE-1999-052410.10.0.104ICMP Timestamp Request Remote Date Disclosure0icmpMicrosoft Windows Server 2008 R2 Standard Service Pack 1
JanuaryCVE-1999-052410.10.0.11ICMP Timestamp Request Remote Date Disclosure0icmpLinux Kernel 3.13 on Ubuntu 14.04 (trusty)
JanuaryCVE-1999-052410.10.0.111ICMP Timestamp Request Remote Date Disclosure0icmpMicrosoft Windows Server 2012 R2 Standard
JanuaryCVE-1999-051110.110.0.222IP Forwarding Enabled0tcpMac OS X 10.4
JanuaryCVE-1999-051110.110.0.224IP Forwarding Enabled0tcpMac OS X 10.4
JanuaryCVE-1999-051110.110.0.225IP Forwarding Enabled0tcpMac OS X 10.4

 

I want to compare if the vulnerability that we found in November still appears in January Scan. 

In this example, the result should be a table with the following results:

 

JanuaryCVE-1999-051110.110.0.222IP Forwarding Enabled0tcpMac OS X 10.4
JanuaryCVE-1999-051110.110.0.224IP Forwarding Enabled0tcpMac OS X 10.4
JanuaryCVE-1999-051110.110.0.225IP Forwarding Enabled0tcp

Mac OS X 10.4

 

Because those three are the only ones that repeat in the last and actual scan. 

@northward

 

OK, let's see if this helps. Create a new calculated column in your table (Table1 is the name of the table):

 

CountColumn =
COUNTROWS ( CALCULATETABLE ( Table1; ALL ( Table1[Month] ) ) )

That makes use of context transition to give you, for each row, the number of times the row appears in the table. You can then select to view the ones with a value greater than 1 in a table visual (and filter to show only January for instance).

I think it worked, but he is considering every month (August, September, November, November, December and January), is it possible for me to specify the months I want to compare, or to always consider the last two months?

Hi @northward

 

As AIB said, you may use slicer to specify the months.I would suggest you ay create below two measures:

CountMeasure = CALCULATE(COUNTROWS(Table1),ALLSELECTED(Table1[Month]))
LastMonth = IF(MAX(Table1[MonthNo])=MAXX(ALLSELECTED(Table1),Table1[MonthNo]),1)

Then use them in visual level filter. CountMeasure>1 and LastMonth =1. Attached the sample file for your reference.

 

Regards,

Cherie

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

How I can make count only the ones that appear more than once? Should I use and "where"?

Hi @northward

 

Could you tell me if your problem has been solved? If it is,kindly mark the helpful answer as a solution and welcome to share your own solution. More people will benefit from here. If not, please share more details for us so that we could help further on it.

 

Regards,

Cherie

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

Hi @northward

 

You may create a measure to get the count.Then set the measure is greater than 1 in visual level filter.Here is the article about this feature for your reference.Please check page 2 in the sample file.

Measure = CALCULATE(COUNTROWS('Table1 (2)'),ALL('Table1 (2)'[Month]))

1.png

Regards,

Cherie

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

@northward

You can set Month in a slicer and select the two months you are interested in

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.