Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi
I have two tables in my report. In query editor I have merged them and then I want to save the result to a text file.
I have tried to add this script to the query Itemlist:
require(gdata)
write.table(trim(dataset), file="C:/Users/KLJ/Documents/Power BI/Test10.txt", sep = "\t", row.names = FALSE, append = TRUE)
plot(dataset);
but I get this message:
(Sorry for the bad picture)
Is there a R script that can save this query to a text file?
R scrips is very new to me.
Here is a link to a copy of the pbix file
Thanks in advance.
Best regards
Kim
Solved! Go to Solution.
Ok, looks like the merge is the issue not the r
@KenPulshas blogged about the "Rebuild This Data Combination" Error.
https://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/
Also discussed here
I've used R to export data a few times from both ther editor and the visuals
This R script works for me.
# 'dataset' holds the input data for this script write.table(dataset, file="C:\\temp\\Test.txt", sep = "\t", row.names = FALSE, append = TRUE) output <- dataset
The M for my test looks like this.
Source = Table.NestedJoin(Table2,{"Column1"},Table2,{"Column1"},"Table2",JoinKind.LeftOuter),
#"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Column2", "Column3"}, {"Table2.Column2", "Table2.Column3"}),
#"Run R Script" = R.Execute("# 'dataset' holds the input data for this script#(lf)#(lf)write.table(dataset, file=""C:\\temp\\Test.txt"", sep = ""\t"", row.names = FALSE, append = TRUE)#(lf)#(lf)output <- dataset",[dataset=#"Expanded Table2"]),
#"""output""" = #"Run R Script"{[Name="output"]}[Value]
in
#"""output"""Trim in r doesn't work on a dataframe. So if you need to trim either do it before you export in M or use sapply functions in r.
M is easiest, but the R option might be quicker with very large datasets.
Hi stretcharm
I've tried your proposal but I still get the same error message.
Ok, looks like the merge is the issue not the r
@KenPulshas blogged about the "Rebuild This Data Combination" Error.
https://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/
Also discussed here
I rebuild the query according to @KenPuls blog but still got the error.
Then I changed the the Privacy for the file to Ignore the privacy levels and it worked.
I not sure that is the right way to do this but ontil there is another solution this most do it for now.
Thank for your help @stretcharm
So turning off Privacy does a couple of things:
The issue is that it no longer checks to make sure the data sources are safe to combine without leaking data. If all my data is in the organization, I usually turn this setting off, but you do want to be careful of just doing that as a blanket answer.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 51 | |
| 46 | |
| 23 | |
| 19 |
| User | Count |
|---|---|
| 138 | |
| 111 | |
| 50 | |
| 33 | |
| 29 |