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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
DaveRuijter
Advocate II
Advocate II

R script fails to load more than 14999 rows

 

Power BI Desktop fails to load more than 14999 rows using an R script.

 

This is the script I'm using:

library(RODBC)
mycon<-odbcDriverConnect('driver={SQL Server};server=<servername>;database=<databasename>;trusted_connection=true')
queryResult <-sqlQuery(mycon, "SELECT TOP 15000 <columns> FROM <view>")
View(queryResult)

The script executes fine in Rstudio.

When I change the TOP 15000 into TOP 14999 the script works fine in Power BI Desktop.

Any ideas what this could be?

 

This is the error message:

DataFormat.Error: Unable to translate bytes [E9] at index 6 from specified code page to Unicode.

1 ACCEPTED SOLUTION

Thanks. I've managed to isolate the problem to a é character in an emailadres..

If I alter the view to replace that character it works for that row, but other rows give errors.

So I've added CONVERT(varchar,Emailadres) COLLATE Cyrillic_General_CI_AI and now it seems to work.

 

The big question remains: why does the query fail in Power BI Desktop while it runs fine in Rstudio?

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

The same script works on 15,000 rows (and more) for me. Can you track down what's in the 15000th row it's possible there's something odd in it (e.g. character data in what otherwise looks to be numeric data).

Thanks. I've managed to isolate the problem to a é character in an emailadres..

If I alter the view to replace that character it works for that row, but other rows give errors.

So I've added CONVERT(varchar,Emailadres) COLLATE Cyrillic_General_CI_AI and now it seems to work.

 

The big question remains: why does the query fail in Power BI Desktop while it runs fine in Rstudio?

This would be a great item to submit as a bug report, especially since you have isolated the problem and have a resokution.

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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