r custom visual
8 TopicsR-Script Visual Runtime Error in Power BI Server
Hi Everyone, I wrote a R-Script that works/runs perfectly in Power BI Desktop but doesn't work when published to the Power BI Service. I'm not able to pinpoint the error, is it the pipe operator (%<%)? Any help would be highly apperciated, I've been struggling with this issue for some time now. Script Runtime Error: Evaulation Error: Level sets of factors are different R-Script: # The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script: # dataset <- data.frame(ProjectName, Commodity, WBS_code, Months, Running_Total_V2, Total_Scope_V2, RTPercentCompleteV2, Project_Description) # dataset <- unique(dataset) # Paste or type your script code here: library(dplyr) library(ggplot2) library(RColorBrewer) proposal_project <- unique(dataset[["Project_Description"]]) # there are duplicates due to WBS df <- dataset %>% select(ProjectName, Commodity, Months, RTPercentCompleteV2) %>% distinct() # for projects with multiple entries for the same percent complete, keep the highest value df <- df %>% group_by(ProjectName, Commodity, RTPercentCompleteV2) %>% slice(which.max(Months)) %>% arrange(Months) # group by and interpolate pctcomplete <- seq(0.1, 1, by=0.05) df <- df %>% group_by(ProjectName, Commodity) %>% group_modify(~ {approx(.x$RTPercentCompleteV2, .x$Months, xout=pctcomplete) %>% data.frame()}) %>% ungroup() prop_df <- df %>% filter(ProjectName == proposal_project) # split out proposal data after transformations df2df <- df %>% filter(ProjectName != proposal_project) data_wo_proposal <- df2df %>% group_by(Commodity,x) %>% summarise_at(vars(y),list(mean_duration = mean)) # plot mindiff <- min(c(0)) maxdiff <- max(c(max(data_wo_proposal$mean_duration, na.rm=TRUE), max(prop_df$y, na.rm=TRUE))) ticks <- round(seq(mindiff, maxdiff, by=2)) tick_y <- seq(0,100, by=5) g <- ggplot(data=data_wo_proposal, aes(x=mean_duration, y=x, colour=Commodity)) + geom_line(linetype=2) + geom_point() final_plot <- g + geom_line(data = prop_df, aes(x=y,y=x,colour=Commodity)) + geom_point(data=prop_df,aes(x=y,y=x,colour=Commodity)) final_plot_label <- final_plot + labs(title='Average Duration of Reference Projects vs Proposal Project', subtitle=paste('Proposal Project:',prop_df$ProjectName[1], '(solid line in figure below)'), x= 'Duration (Months)',y='Percent Complete') + theme_bw() + theme(legend.position='bottom', legend.title=element_blank()) + scale_colour_brewer(palette='Set1') + scale_x_continuous(breaks=ticks)+scale_y_continuous(labels = scales::percent_format(accuracy = 1),breaks=seq(0,1, by=.05)) final_plot_label Thank you, ValSolvedR Custom Power BI Visualization Variable Input Handling
I am trying to create a custom viz (scatter plot) with the ability to provide different options for colour and shape of the points using ggplot2. My visualisation works fine when I specify both the Shape and Colour parameter, however, I want to be able to only supply one or the other down the road, not always both. This is what my parameter options look like: While my R script.r file for ingesting data is: This is the error I get when I don't include Colour or Shape or both. I feel that the ability to handle not supplying an argument should be handled within the script which I have tried to do. However, I am now stuck.Custom Visual isn't showing in report. Using R
Dear All, I have created a custom visual using R script in Power bi (online). Actually I was looking to create interactive visualization using R language. I have followed all the steps one by one given in these two articles. 1. https://www.blue-granite.com/tutorials/power-bi-interactive-r-visual 2. https://docs.microsoft.com/en-us/power-bi/developer/visuals/custom-visual-develop-tutorial#troubleshooting Right now there is no error but the blank screen. Some time it shows an error e.g (Script timeout error) Kindly help how to get rid of this problem. Thanks Regards, Nabeel MukhtarNeed a horizontal funnel chart
Hi members, I am looking for a way to visualize a funnel horizontally. I have been looking into the 'horizontal funnel by MAQ' but that one is not useful for me. Default PBI visual for a funnel has all the options that I need, except that it is not horizontal. Any ideas are welcome. Thank you very much in advance! Kind regards, Kaya1.4KViews1like0CommentsUsing Association Rules Custom Visual
Hi, I stumbled upon the "Association Rules" visual published by Microsoft, which I want to use since my Python script wont work if I publish the report to Power BI Service (at least that's what I read). My data is a table of 2 columns, like this: An ID column and a category column. However, I'm quite puzzled about how to use the visual: How do I use this? In my Python script, I proceed to transform the above 2 columns into a transactional dataset and then I apply the Apriori algorithm and then find the association rules. However, I don't really get the "LHS", "RHS" and "BOTH" parameters? I've tried using the category column for all parameters wihtout luck2.3KViews2likes0CommentsLegend Displaying differently on PowerBI Desktop and PowerBI Service
I was working on a custom visual using R and plotly to render a graph with multiple Y-Axes. I can see the legend as I expect to see it when I'm authoring a report on PowerBI Desktop. But I can't see the legend as I expect it in PowerBI Service when I try publishing it. I suspect it has something to do with this line of code in R, but I'm not sure: paly1 = c("red","green") p = plot_ly() %>% add_lines(x = Values$Time, y = Values$ActualValues, name = paste(Values$name, "(", names(Values$name)[1], ")", " "), colors = ~paly1) In this scenario, Values is a dataRole that will definitely have a 'Time' column with various timestamps for the X-Axis, an 'ActualValues' column to be plotted along the Y-Axis, and a 'name' column for the legend. The name is something the user can filter. So on Desktop this is how I see the legend (as expected): Value$name consists of all these rows. But in PowerBI Service, I end up seeing: And the 5 lines that are supposed to be plotted also all look blue in color. How could I fix this?SolvedR Script Colour Brewer
Hi Guys, I created an area graph, for 32 unique names. the main issue i'm having, is that whenever i try to make scale_fill_brewer(palette="Greens"), to work - it only colours 8 of the names, and leaves the rest of the names white. what i want is a way to shade the names into 32 unique shades of green automatically ( i cant just list 32 different greens, because if i add another name into the list, i dont want to go back in and edit the R-Script code).Issue with plotly R package and PowerBI - Visual showing weird annotation
Hello everyone, I've developed a simple visual using the rhtml template and the package plotly to show a scatter plot with annotations on specific points. On Rstudio it works fine, but when I load it into PowerBI (or test it using the developer visual on service) a blank annotation without any logic appears on random spots of the visualization. Rstudio: PowerBI Note the weird floating arrow (yellow mark added to highlight the issue). I've zipped the pbix file, the visual folder and the dataset used on the example, here's the link: Files Is this a bug? Kind regards, Bruno Ritter