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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vnqt
Helper V
Helper V

Related with IF Statement

Hi ,

 

I have 2 related tables  (*-1): 

Table A 

HostDeviceIP
Host1vmk0IP1
Host2vmk0IP2
Host3vmk0IP3
Host4vmk0IP4
Host5vmk0IP5
Host6vmk0IP6
Host7vmk0IP7
Host8vmk0IP8
Host9vmk0IP9
Host1vmk1IP10
Host2vmk1IP11
Host3vmk1IP12
Host4vmk1IP13
Host5vmk1IP14
Host6vmk1IP15
Host7vmk1IP16
Host8vmk1IP17
Host9vmk1IP18
Host10vmk2IP19
Host11vmk3IP20
Host12vmk4IP21
Host13vmk5IP22
Host14vmk6IP23

Table B

 

Host
Host1
Host2
Host3
Host4
Host5
Host6
Host7
Host8
Host9

 

I would like to add the table B two columns : 

Table B (result)

HostIP VMK0IP VMK1
Host1IP1IP10
Host2IP2IP11
Host3IP3IP12
Host4IP4IP13
Host5IP5IP14
Host6IP6IP15
Host7IP7IP16
Host8IP8IP17
Host9IP9IP18

IP VMK0 =  IF(TableA[Device] = "vmk0", TableA[IP])

IP VMK1 =  IF(TableA[Device] = "vmk1", TableA[IP])

 

Thank you in advance for your help. 

Tg

1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

Hi @vnqt ,

If you need a calculated column, here is one of the ways:

IP VMK0 = 
VAR IPVMK = "vmk0"
VAR t = FILTER ( TableA, TableA[Device] = IPVMK && TableA[Host] = TableB[Host] )
RETURN
    MAXX ( t, TableA[IP] )
IP VMK1 = 
VAR IPVMK = "vmk1"
VAR t = FILTER ( TableA, TableA[Device] = IPVMK && TableA[Host] = TableB[Host] )
RETURN
    MAXX ( t, TableA[IP] )

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

3 REPLIES 3
ERD
Community Champion
Community Champion

Or, if it is to be a measure:

IP VMK0 measure = 
VAR IPVMK = "vmk0"
VAR t = FILTER ( TableA, TableA[Device] = IPVMK && TableA[Host] = SELECTEDVALUE(TableB[Host]) )
RETURN
    MAXX ( t, TableA[IP] )

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

ERD
Community Champion
Community Champion

Hi @vnqt ,

If you need a calculated column, here is one of the ways:

IP VMK0 = 
VAR IPVMK = "vmk0"
VAR t = FILTER ( TableA, TableA[Device] = IPVMK && TableA[Host] = TableB[Host] )
RETURN
    MAXX ( t, TableA[IP] )
IP VMK1 = 
VAR IPVMK = "vmk1"
VAR t = FILTER ( TableA, TableA[Device] = IPVMK && TableA[Host] = TableB[Host] )
RETURN
    MAXX ( t, TableA[IP] )

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Thank you for your prompt reply. 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.