Forum Discussion
Getting two attachments in same row for one ID
- Anonymous1 year ago
Hi Anonymous
Thank you very much saud968 for your prompt reply.
For your question, here is the method I provided:
Here's some dummy data
"Responses"
Create a new table.
AttachmentsWithLinks = SUMMARIZE( 'Responses', 'Responses'[ID], "Attachment_Links", CONCATENATEX( 'Responses', "<a href='" & 'Responses'[URL] & "' target='_blank'>" & 'Responses'[Attachment Name] & "</a>", ", " ) )
Go to the Visualizations pane and click "Get more visuals".Search for and install Shielded HTML Viewer.
Adding an HTML Viewer to a Report.
This way, each attachment name is a clickable link that opens the corresponding URL in the browser.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Let's try a different approach to ensure the attachments are displayed as clickable URLs in Power BI. We'll use a combination of DAX and Power Query to achieve this.
Step 1: Create a Calculated Column for HTML Links
First, create a new calculated column in your table with the following DAX formula:
Attachments_HTML =
VAR Attachments =
CONCATENATEX(
'Responses',
"<a href='" & 'Responses'[URL] & "' target='_blank'>" & 'Responses'[Attachment Name] & "</a>",
", "
)
RETURN Attachments
Step 2: Enable HTML Content in Power Query
Go to Power Query Editor:
In Power BI Desktop, click on Transform Data to open the Power Query Editor.
Add a Custom Column:
In the Power Query Editor, select your table and click on Add Column > Custom Column.
Use the following formula to create a custom column that combines the attachment names and URLs into HTML links:
= Table.AddColumn(#"PreviousStepName", "Attachments_HTML", each Text.Combine(List.Transform([Attachments], each "<a href='" & [URL] & "' target='_blank'>" & [Attachment Name] & "</a>"), ", "))
Replace #"PreviousStepName" with the name of the previous step in your query.
Close and Apply:
Click on Close & Apply to save your changes and return to Power BI Desktop.
Step 3: Use the HTML Column in Your Visual
Add the HTML Column to Your Visual:
Add the Attachments_HTML column to your table or matrix visual.
Enable HTML Content:
Go to the format pane of your table or matrix visual.
Under the Values section, turn on the URL icon option.
This should render the HTML content as clickable links in your visual. Each attachment name will be displayed as a clickable URL that navigates to the respective link.
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
After adding Custom column , it came as table and I expanded Attachments_Html column, it given below error
Expression.Error: We cannot convert the value null to type List.
Details:
Value=
Type=[Type]
we have nulls also in Attachment Filename column
Could you please help...