Forum Discussion

Baldy's avatar
Baldy
Frequent Visitor
9 years ago
Solved

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. ...
  • v-ljerr-msft's avatar
    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