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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Power BI Custom R Visual - How to display a table generated in r?

I am having trouble with an R Visual I am creating in Power BI. I am acually trying to display a table, however, whenever I bring in a table I create in R using one of the supported R libraries in the Power BI documentation, I receive a "This visual cannot be displayed" error.

 

Here is the documentation I'm referencing https://docs.microsoft.com/en-us/power-bi/connect-data/service-r-packages-support ... in particular, I would like to display a table created in r using the "htmlTable" library. At this point, I will take the simplest option available so long as it displays the information I need it to correctly.

 

The best I can generate so far is as follows, using the "grid.table()" function in R. Please ignore the red outline white boxes as those hide sensitive data:

proffieh_0-1607364606883.png

The R visual is the bottom visual, and it pulls into Power BI in a distorted view, as you can see in the screenshot.

 

Every table visual I have created in R does not work in Power BI. Is there an easier way or known method to do this?

 

2 REPLIES 2
cavamic
Regular Visitor

Hello - I was having a similar problem rending htmlTable but seemingly solved it . 

 

When creating an htmlTable, use its htmlTableWidget() function to create an htmlwidget instead of the basic htmlTable() which creates a character. I then passed this widget into save Widget from htmlwidgets package.  

 

 

table <- htmlwidget(mtcars)

saveWidget(table, 'out.html')

 

 

 

Anonymous
Not applicable

The output of an R script visual in Power BI needs to be an image format (PNG/JPG). There should be a few supported packages that can do this for you, such as webshot, if an export function isn't built-in. Just know image outputs aren't interactable.

 

If you need the visual to be interactable, the only option is to get into Power BI Custom Visual territory. Thankfully, there's an R based template and it's actually not that hard to get it running, but you may struggle with getting the correct version of XML installed (used to save html widgets for Power BI consumption in flatten_HTML). A workaround is to swap out the XML package with xml2 per this PR. Feel free to DM for help if you go this way.

 

Edit: This is an R script, right? Not an rhtml visual? Personally not a fan of MS's naming conventions, they cause a lot of confusion.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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