Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I'm new to the subject. 2 months ago I took on the task of investigating how to show in Power BI the 'time scale' of Ms Project. This led me to investigate something of the R language, which was unknown. I have already advanced the subject by creating a visualization object, but there are 3 relevant incidents. . The incidences are:
1. In the text you are not taking the special characters, in this case the accents.
2. The position of the date does not take it relative, therefore at the beginning and end of the Gantt some data of the date are hidden.
3. The date format is required to be dd-mmm. The POSIXct function is being used.
I'm not very good with English, but I need help, sorry!
The code:
############### Library Declarations ############### libraryRequireInstall("ggplot2"); #################################################### ################### Actual code #################### ##g = qplot(`Petal.Length`, data = iris, fill = `Species`, main = Sys.time()); #devtools::install_github('hadley/ggplot2') #library(devtools) library(ggplot2) library(plotly) #library(scales) #library(stringi) #library(twitteR) #library(ggrepel) Values$TaskLabel <- Values$Nombredetarea # Convert timestamp to POSIXct. Values$Comienzo<-as.POSIXct(Values$Comienzo, format="%Y-%m-%d") Values$Fin<-as.POSIXct(Values$Fin, format="%Y-%m-%d") fechaconverini <- as.Date(Values$Comienzo, format = "%d/%m/%y") fechaconverfin <- as.Date(Values$Fin, format = "%d/%m/%y") Nombredetarea <- substr(Values$Nombredetarea, 1, 70) Values$Nombredetarea <- factor(Nombredetarea, levels = Nombredetarea[order(Values$Comienzo, decreasing=TRUE)]) p <- ggplot(Values, aes(x=Values$Comienzo, y=Nombredetarea, colour=factor(ClasificacionActivity), text = paste('</br>Actividad: ', Values$TaskLabel, '</br>Comienzo: ', Comienzo, '</br>Fin: ', Fin))) p <- p + theme_bw() #p <- p + scale_x_date(labels = date_format("%b/%y")) #p <- p + facet_grid(ClasificacionActivity ~ ., scales="free_y") #p <- p + facet_grid(.~ClasificacionActivity, scales="free") #p <- p + facet_wrap(~ClasificacionActivity) p <- p + theme(strip.text = element_text(size=4), strip.background = element_rect(fill="lightblue", colour="black",size=1)) #################################################### ############# Create and save widget ############### internalSaveWidget(p, 'out.html'); ####################################################
in the following link, see attached file 'Activity Plan in Power BI - Support v.3.pptx'. Additionally, attached file 'Activity Plan R 20181002 v.2.pbix' where the incidents can be reproduced:
I appreciate support.
Thank you.
Hi all,
Incidence No. 1 and No. 3 was solved.
Incidence No. 1
After testing and testing code related to Sys.setlocale and not getting the result. It was proposed as a temporary solution to create a column using the DAX SUBSTITUTE function where the tildes were removed.
Incidence No. 3
Through the implementation of the following code, it was solved:
Comienzo <- as.Date(as.character(Values$Comienzo), "%Y-%m-%d") Comienzo2 <- format(Comienzo, format = "%d/%b")
Incident No. 2 is pending, I appreciate collaboration!
2. The position of the date does not take it relative, therefore at the beginning and end of the Gantt some data of the date are hidden.
Thank you.
User | Count |
---|---|
5 | |
5 | |
3 | |
2 | |
2 |
User | Count |
---|---|
9 | |
7 | |
5 | |
4 | |
4 |