Forum Discussion
friend_anand
6 years agoNew Member
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...
- 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.
GilbertQ
Super User
6 years agoHi there
Can you please provide some sample data?
And also what the expected result would look like with an image or a mock up via Excel?
Can you please provide some sample data?
And also what the expected result would look like with an image or a mock up via Excel?
friend_anand
6 years agoNew Member
Hi,
Thanks for your response.
Here is a sample data:
| Division Name | Manager Hire Year | 2016 | 2017 | 2018 | 2019 | 2020 YTD |
| Division A | 2019 | 84335 | 89426 | 93897.3 | 150235.7 | 180282.8 |
| Division B | 2018 | 87572 | 92357 | 129299.8 | 193949.7 | 155159.8 |
| Division C | 2017 | 74420 | 141398 | 155537.8 | 202199.1 | 242639 |
| Division D | 2018 | 93804 | 73804 | 125466.8 | 188200.2 | 207020.2 |
And below is a chart I made in excel with the above table excluding the 2nd column (Manager Hire Date).
I am looking at an output which will be like below. I have plotted the year in which the manager was hired for each division.
Please advise if this is possbile in Power BI visuals.
Thanks in advance for your help..
Anand