Forum Discussion
Baldy
9 years agoFrequent Visitor
How to use an if statement to create a column based on values from 2 tables
Hi, I am new Power BI and am really struggling to create a column I have 2 tables, 1 that contains stripped down IP address columns and another table that contains an IP range and a location name. ...
- 9 years ago
Hi Baldy,
Based on my test with your sample data, you should be able to use the formula(DAX) below to create new calculate column in Table1 in your scenario. :smileyhappy:
Column3 = CALCULATE ( FIRSTNONBLANK ( Table2[Column4], 1 ), FILTER ( Table2, Table2[Column1] = Table1[Column1] && ( Table1[Column2] >= Table2[Column2] && Table1[Column2] <= Table2[Column3] ) ) )Regards
v-ljerr-msft
9 years agoMicrosoft Employee
Hi Baldy,
Based on my test with your sample data, you should be able to use the formula(DAX) below to create new calculate column in Table1 in your scenario. :smileyhappy:
Column3 =
CALCULATE (
FIRSTNONBLANK ( Table2[Column4], 1 ),
FILTER (
Table2,
Table2[Column1] = Table1[Column1]
&& ( Table1[Column2] >= Table2[Column2]
&& Table1[Column2] <= Table2[Column3] )
)
)
Regards
- Baldy9 years agoFrequent Visitor
This works perfectly.
Thank you to every one for your time it is very much apritiated
Alan