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
PowerBeeEye
Employee
Employee

Value in table 1 exist/does not exist in table 2 for each entity

I have 3 tables:

 

Servers

Server_Name 

Server_OS

 

Server_1

     

Windows Server 2016

     

Server_2

     

Windows Server 2019

     

Server_3

     

Windows Server 2016

     

 

 

All Updates

Server_Name 

Patch_ID

 

Server_1

     

KB123

     

Server_1

     

KB456

     

Server_2

     

KB123

     

 

Critical_Patch

OS

 

KB_ID

Windows Server 2016

     

KB456

Windows Server 2019

     

KB789

 

I would like to have the conditional column like so

Servers

Server_Name

 

Server_OS

 

Critical_Patch_Installed

Server_1

 

Windows Server 2016

 

Yes

Server_2

 

Windows Server 2019

 

No

Server_3

 

Windows Server 2016

 

No

 

 

Essentially, For each server in SERVERS,

if list of all KB_IDs in ALL UPDATES for matching [Server_Name] contains mathing [KB_ID] in CRITICAL_PATCH for matching [OS]then [Critical_Patch_Installed] = "yes"

 

 

Really appreciate the help!

1 ACCEPTED SOLUTION

@PowerBeeEye 

Please check now:

You can download the file: HERE

 

Critical_Patch_Installed = 

VAR _UPDATE = 
SELECTCOLUMNS(
FILTER(
	GENERATE(
		'CVE-2020-1350',
		Q_Domain_Controllers_Hotfix_Latest
	),
	'CVE-2020-1350'[KBID] = Q_Domain_Controllers_Hotfix_Latest[HotFixID]
),
"_SERVER", Q_Domain_Controllers_Hotfix_Latest[ComputerDNS]
)

RETURN
IF( 
    SELECTEDVALUE(Q_Domain_Controllers_Latest[dnshostname]) IN _UPDATE,
    "Yes",
    "No"
)

Fowmy_0-1599166168189.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

13 REPLIES 13
Fowmy
Super User
Super User

@PowerBeeEye 

Please check this solution, I did not create any relationships between Tables.

Critical_Patch_Installed = 

VAR _UPDATE = 
SELECTCOLUMNS(
FILTER(
	GENERATE(
		'All Updates',
		Critical_Patch
	),
	'All Updates'[Patch_ID] = Critical_Patch[KB_ID]
),
"_SERVER", 'All Updates'[Server_Name]
)

RETURN
IF( 
    SELECTEDVALUE(Servers[Server_OS]) IN _UPDATE,
    "Yes",
    "No"
)

Fowmy_0-1599160264668.png

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy 

 

Sorry, but I don't think that worked. Perhaps I made a mitake with the column names, but here are the tables once again:

 

CVE-2020-1350

KBIDOS
KB4565541Windows Server 2012 R2
KB3000483Windows Server 2016
KB4558998Windows Server 2019

 

Q_Domain_Controllers_Latest

operatingsystemdnshostname
Windows Server 2016Server1.domain.ext
Windows Server 2019Server2.domain.ext
Windows Server 2012 R2Server3.domain.ext

 

Q_Domain_Controllers_Hotfix_Latest

HotFixIDComputerDNS
KB3000483Server1.domain.ext
KB3003057Server1.domain.ext
KB3011780Server1.domain.ext
KB3019978Server2.domain.ext
KB3023266Server2.domain.ext
KB3035126Server2.domain.ext
KB3045685Server3.domain.ext
KB3045999Server3.domain.ext
KB4565541Server3.domain.ext

 

What I'm looking for:

 

Q_Domain_Controllers_Latest

operatingsystemdnshostname
CC_DNSVulnerabilityPatchInstalled
Windows Server 2016Server1.domain.extYes
Windows Server 2019Server2.domain.extNo
Windows Server 2012 R2Server3.domain.extYes

 

 

 

Hi @PowerBeeEye ,

You can create a measure as below:

CC_DNSVulnerabilityPatchInstalled =
VAR _patches =
    CONCATENATEX (
        FILTER (
            ALLSELECTED ( 'Q_Domain_Controllers_Hotfix_Latest' ),
            'Q_Domain_Controllers_Hotfix_Latest'[ComputerDNS]
                = MAX ( 'Q_Domain_Controllers_Latest'[dnshostname] )
        ),
        'Q_Domain_Controllers_Hotfix_Latest'[HotFixID],
        ","
    )
VAR _npatches =
    SUBSTITUTE ( _patches, ",", "" )
VAR _index =
    ROUND ( LEN ( _npatches ) / 9, 0 ) - 1
VAR mytable =
    ADDCOLUMNS (
        GENERATESERIES ( 0, _index ),
        "mylist",
             (
                MID ( _npatches, [Value] * 9 + 1, 9 )
            )
    )
VAR mylist =
    SELECTCOLUMNS ( mytable, "list", [mylist] )
VAR _a =
    CALCULATE (
        DISTINCTCOUNT ( 'CVE-2020-1350'[KBID] ),
        FILTER (
            ALLSELECTED ( 'CVE-2020-1350' ),
            'CVE-2020-1350'[KBID] IN mylist
                && 'CVE-2020-1350'[OS] = MAX ( 'Q_Domain_Controllers_Latest'[operatingsystem] )
        )
    )
RETURN
    IF ( _a > 0, "Yes", "No" )

Value in table 1 exist does not exist in table 2 for each entity.JPG

Best Regards

Rena

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

thank you @v-yiruan-msft 

 

One issue though - the column 'CVE-2020-1350'[OS] does not contain unique values:

 

KBIDOS
KB4565524Windows Server 2008 R2
KB4565539Windows Server 2008 R2
KB4565537Windows Server 2012
KB4565535Windows Server 2012
KB4565541Windows Server 2012 R2
KB4565540Windows Server 2012 R2
KB4565511Windows Server 2016
KB4558998Windows Server 2019
KB4559003Windows Server 2019

 

 

Hi @PowerBeeEye ,

Please try to set the cardinality of relationship between table CVE-2020-1350 and table Q_Domain_Controllers_Latest as Many to One and check if the measure "CC_DNSVulnerabilityPatchInstalled" still works well. Any concern or problem please feel free to let me know.

relationship.JPG

Best Regards

Rena

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

@v-yiruan-msft 

 

Unfortunately, that would not work since neither of the columns have only unique values; both the 

OperatingSystem column in the Q_Domain_Controllers_Latest table, and 

OS column in CVE-2020-1350 table have repeating values.

 

Here is a list of unique values:

  • CVE-2020-1350 [KBID]
  • Q_Domain_Controllers_Latest [dnshostname]

 

Hi @PowerBeeEye ,

Here I will share my sample pbix file with you. Could you please help to check if I missed any information that caused the measure can't work well in your side ? Thank you. About the problem of duplicated values the OperatingSystem column in Q_Domain_Controllers_Latest table and OS column in CVE-2020-1350 table, the cardinality of relationship between them has be set as Many to Many in my sample pbix fie.

Best Regards

Rena

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

@v-yiruan-msft 

Hi did you try my solution?

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy  I think I got it working - I am verifying the output.

One question - how can I use the measure in a visualizer? I would like to show how many servers have "yes" and how many have "no".

@PowerBeeEye 

You can download the file: HERE


To visualize the count based on YES/NO, create a table using the enter data option:

Fowmy_0-1600156325097.png

 

Add this measure:

Path Installs = 
COUNTROWS(
    FILTER(
        Q_Domain_Controllers_Latest ,
        [Critical_Patch_Installed] = SELECTEDVALUE('Path Installed'[Path Installed Status])
    )    
)


Show it in a column chart or any other suitable visual you prefer.

Fowmy_1-1600156438234.png

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 






 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

thank you very much, @Fowmy  this looks like it works very well!

@v-yiruan-msft Unfortunately, I cannot select a many to many relationship since I'm using the Power BI Desktop optimized for Reporting Server and I intend to save it on the reporting server.

My only options are *:1, 1:1 and 1:*

 

How can we workaround this?

@PowerBeeEye 

Please check now:

You can download the file: HERE

 

Critical_Patch_Installed = 

VAR _UPDATE = 
SELECTCOLUMNS(
FILTER(
	GENERATE(
		'CVE-2020-1350',
		Q_Domain_Controllers_Hotfix_Latest
	),
	'CVE-2020-1350'[KBID] = Q_Domain_Controllers_Hotfix_Latest[HotFixID]
),
"_SERVER", Q_Domain_Controllers_Hotfix_Latest[ComputerDNS]
)

RETURN
IF( 
    SELECTEDVALUE(Q_Domain_Controllers_Latest[dnshostname]) IN _UPDATE,
    "Yes",
    "No"
)

Fowmy_0-1599166168189.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.