Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
rcardenasbc
Frequent Visitor

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

1 ACCEPTED SOLUTION
mark_endicott
Super User
Super User

You can use 2 measures for this. I have taken your sample data and made the below:

mark_endicott_0-1717169804895.png

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:

 

mark_endicott_1-1717170006023.png

If this works, please mark this as the solution. 

View solution in original post

2 REPLIES 2
v-kongfanf-msft
Community Support
Community Support

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

mark_endicott
Super User
Super User

You can use 2 measures for this. I have taken your sample data and made the below:

mark_endicott_0-1717169804895.png

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:

 

mark_endicott_1-1717170006023.png

If this works, please mark this as the solution. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.