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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
bashheadonwall
New Member

How do I create a custom column that grabs the ip from a description?

I'm trying to make a simple dashboard to review our logs and was hoping I could create  custom column that grabs IP addresses from the description but I am having a rough time when there is no IP or if its not in between two lines.

 

Is there a way for powerbi to look for #.#.#.# which is typically an IP address and display it in a column and not show anything if there isn't an IP #.#.#.# in the description? 

bashheadonwall_0-1642541863273.png

 

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @bashheadonwall ,

Use the following dax to create a new column:

 

Column = 
VAR test1 =
    MID ( 'Table'[Description], SEARCH ( ":", 'Table'[Description],, 0 ) + 1, 1 )
VAR test2 =
    SEARCH (
        ",",
        'Table'[Description],
        SEARCH ( ":", 'Table'[Description],, 0 ) + 1,
        0
    )
VAR test3 =
    IF (
        test1 = "1"
            || test1 = "2"
            || test1 = "3"
            || test1 = "4"
            || test1 = "5"
            || test1 = "6"
            || test1 = "7"
            || test1 = "8"
            || test1 = "9"
            || test1 = "0",
        MID (
            'Table'[Description],
            SEARCH ( ":", 'Table'[Description],, 0 ) + 1,
            test2
                - ( SEARCH ( ":", 'Table'[Description],, 0 ) + 1 )
        )
    )
RETURN
    test3

 

 

return:

vluwangmsft_0-1643183926288.png

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @bashheadonwall ,

Use the following dax to create a new column:

 

Column = 
VAR test1 =
    MID ( 'Table'[Description], SEARCH ( ":", 'Table'[Description],, 0 ) + 1, 1 )
VAR test2 =
    SEARCH (
        ",",
        'Table'[Description],
        SEARCH ( ":", 'Table'[Description],, 0 ) + 1,
        0
    )
VAR test3 =
    IF (
        test1 = "1"
            || test1 = "2"
            || test1 = "3"
            || test1 = "4"
            || test1 = "5"
            || test1 = "6"
            || test1 = "7"
            || test1 = "8"
            || test1 = "9"
            || test1 = "0",
        MID (
            'Table'[Description],
            SEARCH ( ":", 'Table'[Description],, 0 ) + 1,
            test2
                - ( SEARCH ( ":", 'Table'[Description],, 0 ) + 1 )
        )
    )
RETURN
    test3

 

 

return:

vluwangmsft_0-1643183926288.png

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

Ashish_Mathur
Super User
Super User

Hi,

Have you tried using the Column from Examples feature of the Query Editor?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.