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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

can we do this similar below in power BI dax.

case
when position('jdbc:snowflake' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '/', 3), ':',1)
when position('jdbc:oracle' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '@', 2), ':',1)
when position('jdbc:sqlserver' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '/', 3), ':',1)
when position('jdbc:db2' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '/', 3), ':',1)
when position('jdbc:teradata' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '/', 3), ':',1)
when position('jdbc:postgresql' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '/', 3), ':',1)
when position('jdbc:spark' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '/', 3), ':',1)
when position('jdbc:mongodb' in jdbc_url) > 0 then split_part(split_part (jdbc_url, '=', 2), ';',1)
else jdbc_url
end as JdbcHost

 

 

Eg: jdbc:oracle:thin:@abcdefg.ddshdss.org:1111/dsdsds - need to split the particular text (abcdefg.ddshdss.org)
      jdbc:sqlserver://asasasasas.dsads2000.org:34343; - (asasasasas.dsads2000.org)

1 ACCEPTED SOLUTION

@Anonymous , Check this power query solution.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Ncs5DoAgFEXRrRhqAzhU38Z9GArg4xQikWdcv0P0nvoOg1jZeUrZ+hjomJeNeus8h3GSzJgZkClPVN0pxqMQpvw27BEhnyGTUhY/ybCMWmv9rk1764QxFw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","@","//",Replacer.ReplaceText,{"Column1"}),
    #"Extracted Text Between Delimiters" = Table.TransformColumns(#"Replaced Value", {{"Column1", each Text.BetweenDelimiters(_, "//", ":"), type text}})
in
    #"Extracted Text Between Delimiters"

 

Add this code as power query/transform data in blank query and check

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

4 REPLIES 4
v-yetao1-msft
Community Support
Community Support

Hi @Anonymous 

Compared to using DAX, it is easier to use the split function in Power Query. The method provided by @amitchandak  is feasible , and I follow his method to extract the data you want .

Ailsamsft_0-1644975641373.png

Best Regard

Community Support Team _ Ailsa Tao

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

amitchandak
Super User
Super User

@Anonymous , you have to create something like that

 

new column =

var _1 =mid([jdbc_url],search("/", [jdbc_url],,0 ) ,3)
Switch(True() ,
search("jdbc:snowflake", [jdbc_url],,0 ) >0 , mid(_1,search(":", _1,,0 ) ,1)
// Add other columns
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak, This above DAX is not working for me. jdbc_url is a column not a hard corded value or measure. Could u please help the exact dax fo this solution?

 

@Anonymous , Check this power query solution.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Ncs5DoAgFEXRrRhqAzhU38Z9GArg4xQikWdcv0P0nvoOg1jZeUrZ+hjomJeNeus8h3GSzJgZkClPVN0pxqMQpvw27BEhnyGTUhY/ybCMWmv9rk1764QxFw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","@","//",Replacer.ReplaceText,{"Column1"}),
    #"Extracted Text Between Delimiters" = Table.TransformColumns(#"Replaced Value", {{"Column1", each Text.BetweenDelimiters(_, "//", ":"), type text}})
in
    #"Extracted Text Between Delimiters"

 

Add this code as power query/transform data in blank query and check

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors