Forum Discussion

CH_MJR79's avatar
CH_MJR79
Helper II
2 years ago
Solved

Line chart will only display dots - no lines

I have added a Line Chart visual to my Power BI file, however whilst the dots are in the correct positions there is no line joining the dots up.

 

The X-Axis shows four years - 2020 to 2023 which are taken from a Years table. The Y-Axis has sales totals for the four years. The Years table is linked to a corresponding Year column on each of the Sales tables.

 

The dots on the chart are showing in the correct positions, and hovering the mouse over each dot shows the correct sales totals.

 

Other charts, e.g. a Bar Chart, Pie Chart etc. all work fine.

 

What am I missing here?

 

This is a screenshot of the chart:

 

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi   CH_MJR79 

    Please refer to the following solution.

    Sample data 

    2022

    2023

    The relationship

    Create a measure

     

    Measure = SWITCH(TRUE(),SELECTEDVALUE('Date'[Dates].[Year])=2022,SUM('2022'[Total]),SELECTEDVALUE('Date'[Dates].[Year])=2023,SUM('2023'[Total]))

     

    Then just input the date column and measure to the visual.

    Output

     

     

    Best Regards!

    Yolo Zhu

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

     

11 Replies

  • Hi CH_MJR79 ,
    From the legend I am assuming you have used 4 separate measures and have added them in X-Axis, which is why theres no line connecting the dots. You would need to just use a single Sales measure and put it in X-axis. It would give you the expected behaviour.

    If thats not the case (4 measures in X-axis), could you please share some more insights about the visuala and the data going into it ?

    If your requirement is solved, please make THIS ANSWER as SOLUTION and help other users find the solution quickly. Please hit the LIKE button if this comment helps you. ğŸ˜Š


     

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    Could you can share more pictures of data table and x-axis ?

    • CH_MJR79's avatar
      CH_MJR79
      Helper II

      Yes of course. Please see below:

       

      The data source is an Excel sheet with four tabs - one for each of the years:

       

      This is the separate Years table:

      These are the relationships:

       

      And the X and Y axis:

       

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi CH_MJR79 

        As Gayatri_D05  mentioned, you can create one measure then put it to the Y-axis.

        e.g 

         

        Measure =
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( 'Years'[Year] ) = 2020, SUM ( '2020'[Sales] ),
            SELECTEDVALUE ( 'Years'[Year] ) = 2021, SUM ( '2021'[Sales] ),
            SELECTEDVALUE ( 'Years'[Year] ) = 2022, SUM ( '2022'[Sales] ),
            SELECTEDVALUE ( 'Years'[Year] ) = 2023, SUM ( '2023'[Sales] )
        )
        

         

        Best Regards!

        Yolo Zhu

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

  • Thanks Anonymous.

    Also resolved via this link as well - it required a single measure for all sales. In error I was using two separate measures.