Forum Discussion

rcardenasbc's avatar
rcardenasbc
Frequent Visitor
2 years ago
Solved

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

 

MonthMonth NumberData 1Dat2Dat3
January1     7,568.10 123,326.35   (15,209.11)
February2   13,268.10 127,972.25  173,897.68
March3   11,696.08 203,625.80      1,761.34
April4     9,447.04 166,556.95      2,058.60
May5     9,118.74   82,340.65 (120,270.06)
June6   11,579.62               -   (338,124.90)
July7   10,339.48               -   (301,912.82)
August8     9,450.14               -   (275,944.09)
September9     8,397.12               -   (245,195.90)
October10     7,914.24               -   (231,095.81)
November11   10,346.78               -   (302,125.98)
December12   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
        calc

    The 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
        calc

    Once 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

  • 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
        calc

    The 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
        calc

    Once 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. 

  • Anonymous's avatar
    Anonymous
    Not 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