Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Hyperlink for a locally stored document

Hello everyone!

 

I have a column in my base which contains links locally stored as "C:\Users\User\Desktop\docX.pdf" 

 

How can I give an hyperlink to this column ?

  • Hi Anonymous ,

    We can change the link to a format like "file:///C:/Users/User/Desktop/docX.pdf" in PowerBI, but this method has many limitation, it only works in PowerBI Service on IE broswer.

    Please refer to the following steps:

    1. In Power Query, use the Replace Value tool to replace all "\" to "/" and all " " (blank) to "%20" like below:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcraKiQktTi0qjokpSc1MT02PiXFJLc4uyS+IifFLLVdIy89JSS2KiTHUK6koUYrVIV6HEck6jCE6YgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type 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"}),
        #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value"," ","%20",Replacer.ReplaceText,{"Column1"})
    in
        #"Replaced Value1"

    2. Use the following DAX query to create a calculated column:

    Column = "file:///" & 'Table'[Column1] 

    Then transfer this column to Web URL like below:

    Then publish this report to PowerBI Service, we use IE to open this report, we can use the link.

    Best Regards,

    Teige

4 Replies

  • TeigeGao's avatar
    TeigeGao
    Icon for Solution Sage rankSolution Sage

    Hi Anonymous ,

    We can change the link to a format like "file:///C:/Users/User/Desktop/docX.pdf" in PowerBI, but this method has many limitation, it only works in PowerBI Service on IE broswer.

    Please refer to the following steps:

    1. In Power Query, use the Replace Value tool to replace all "\" to "/" and all " " (blank) to "%20" like below:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcraKiQktTi0qjokpSc1MT02PiXFJLc4uyS+IifFLLVdIy89JSS2KiTHUK6koUYrVIV6HEck6jCE6YgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type 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"}),
        #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value"," ","%20",Replacer.ReplaceText,{"Column1"})
    in
        #"Replaced Value1"

    2. Use the following DAX query to create a calculated column:

    Column = "file:///" & 'Table'[Column1] 

    Then transfer this column to Web URL like below:

    Then publish this report to PowerBI Service, we use IE to open this report, we can use the link.

    Best Regards,

    Teige

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi TeigeGao 

       

      Thanks for answering.

      I would like to do it in Power BI Desktop. Is it possible ?

       

       

      • TeigeGao's avatar
        TeigeGao
        Icon for Solution Sage rankSolution Sage

        Hi Anonymous ,

        As I mentioned above, it is not possible to do it in PowerBI Desktop, the workaround only works on PowerBI Service with IE broswer.

        Best Regards,

        Teige