Forum Discussion
Line graph with solid and dotted lines
Hello, I need a lot of help, I want to make a line graph where the x axis are the months of the year and the y axis are 3 values, but I don't know how to make the lines appear dotted starting from the current month, I already do it. I did it with Python but some visual elements are lost when using the Power BI visual, how can I do this? Thank you very much.
Example data
| Month | Month Number | Data 1 | Dat2 | Dat3 |
| January | 1 | 7,568.10 | 123,326.35 | (15,209.11) |
| February | 2 | 13,268.10 | 127,972.25 | 173,897.68 |
| March | 3 | 11,696.08 | 203,625.80 | 1,761.34 |
| April | 4 | 9,447.04 | 166,556.95 | 2,058.60 |
| May | 5 | 9,118.74 | 82,340.65 | (120,270.06) |
| June | 6 | 11,579.62 | - | (338,124.90) |
| July | 7 | 10,339.48 | - | (301,912.82) |
| August | 8 | 9,450.14 | - | (275,944.09) |
| September | 9 | 8,397.12 | - | (245,195.90) |
| October | 10 | 7,914.24 | - | (231,095.81) |
| November | 11 | 10,346.78 | - | (302,125.98) |
| December | 12 | 10,147.86 | - | (296,317.51) |
Regards
You can use 2 measures for this. I have taken your sample data and made the below:
My two measures are as follows, starting with Previous Months:
VAR month_now = MONTH ( NOW () ) VAR calc = CALCULATE ( SUM ( 'Table'[Data 1] ), KEEPFILTERS ( 'Table'[Month Number] < 5 ) ) RETURN calcThe next one does current and future months:
VAR month_now = MONTH ( NOW () ) VAR calc = CALCULATE ( SUM ( 'Table'[Data 1] ), KEEPFILTERS ( 'Table'[Month Number] >= month_now ) ) RETURN calcOnce you have put the two measures in the Y-Axis of the chart, you can set the Line settings for the Current Month Line differently:
If this works, please mark this as the solution.
2 Replies
- mark_endicott
Super User
You can use 2 measures for this. I have taken your sample data and made the below:
My two measures are as follows, starting with Previous Months:
VAR month_now = MONTH ( NOW () ) VAR calc = CALCULATE ( SUM ( 'Table'[Data 1] ), KEEPFILTERS ( 'Table'[Month Number] < 5 ) ) RETURN calcThe next one does current and future months:
VAR month_now = MONTH ( NOW () ) VAR calc = CALCULATE ( SUM ( 'Table'[Data 1] ), KEEPFILTERS ( 'Table'[Month Number] >= month_now ) ) RETURN calcOnce you have put the two measures in the Y-Axis of the chart, you can set the Line settings for the Current Month Line differently:
If this works, please mark this as the solution.
- AnonymousNot applicable
Hi rcardenasbc ,
Did mark_endicott reply solve your problem? If so, please mark it as the correct solution, and point out if the problem persists.
Best Regards,
Adamk Kong