Forum Discussion

friend_anand's avatar
friend_anand
New Member
6 years ago
Solved

Line graph with markers in Power BI

Hi, I need to create line graph to show sales growth trends for past 5 years. 1 line per division for 4 divisions.   Each division had hired division manager, so we need these lines to differenti...
  • Icey's avatar
    6 years ago

    Hi friend_anand ,

     

    Try to create a R visual.

     

    1. UnPivot.

     

    2. Create a R visual.

    # 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(Year, DivisionName, ManagerHireYear, Value)
    # dataset <- unique(dataset)
    
    # Paste or type your script code here:
    library(ggplot2)
    library(dplyr)
    dataset2<-dataset %>% filter(Year==ManagerHireYear)
    ggplot(data = dataset,aes(y = Value, x = Year, colour = DivisionName)) + geom_line(stat="identity") + geom_point(data=dataset2,aes(x=ManagerHireYear,y=Value)) 

     

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.