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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Issue with importing R program into PowerBI

I have attached the R code and it is working absolutely fine in R Gui.

But when I imported it into Power BI, it is not working. Please help me with this.

x<-c(0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5,11.5,12.5,13.5,14.5,15.5,16.5,17.5,18.5)

y<-c(60.62259458,470.1189752,865.3944386,1130.487698,1242.078749,1210.563709,1071.719665,872.8184187,658.8630463,463.2443228,304.3777303,187.3412277,108.2011552,58.7199621,29.97392294,14.40326246,6.519647521,2.781426084,1.118883814)
logfunction1<-log(x)
for(l in 1: (length(x)))
{
	if(l==1)
	{
		b[l]<-y[l]
	}
	else{
		b[l]<-b[l-1]+y[l]
	}
}
print(b)
m<-max(b)
d<-1:19
for(l in 1: (length(x)))
{
	d[l]<-(b[l]-0.3)/(m+0.4)
}
print(d)
logfunction2<-1:19
for(l in 1: (length(x)))
{
	logfunction2[l]<-(log(log(1/(1-d[l]))))
}
print(length(logfunction2))
print(length(logfunction1))


e<-summary(lm.r)$coefficients[2]
f<-summary(lm.r)$coefficients[1]

alpha<-(exp(-f/e))
print(alpha)
beta<-e
print(beta)

z<-dweibull(x,beta,alpha,log = FALSE)

plot(x,z, type="b",col = "red", xlab="x value", ylab="Density", main="Comparison of t Distributions")

 

Status: Needs Info
Comments
v-haibl-msft
Microsoft Employee

@tejasnd

 

Could you please provide your PBIX file which has the R script visuals? You can share it through online file service like OneDrive.

 

Best Regards,
Herbert

Vicky_Song
Impactful Individual
Status changed to: Needs Info
 
tejasnd
Frequent Visitor

@v-haibl-msft Can I share google drive link because I don't use OneDrive?

tejasnd
Frequent Visitor

 Here is the link: .pbix file

tejasnd
Frequent Visitor

I have just figured out that there is NaN issue because of log function. And denominator becomes zero. InR the data is not rounding up but in powerBI it is rounding upto some decimal places.

 

Please tell me how to use the exact value without any change/round-up in powerBI. Or 5 decimal places will be sufficient.

v-haibl-msft
Microsoft Employee

@tejasnd

 

We can change the decimal place in Modeling - Formatting as below in Power BI Desktop.

 

Issue with importing R program into PowerBI_1.jpg

 

Best Regards,
Herbert