Forum Discussion

hylosko's avatar
hylosko
Helper III
4 years ago
Solved

Line chart intermittent line

Hello power bi experts !   It is any possibility to do line chart like in my picture ?    W - it is week, for example 1,2,3,4,5  
  • v-kkf-msft's avatar
    v-kkf-msft
    4 years ago

    Hi hylosko ,

     

    According to the documentation, we can only set predicted values for incremental numeric or date x-axis.

     

    Introducing new forecasting capabilities in Power View for Office 365 :

    Forecast is available for line charts only. The x-axis value needs to have a date/time format or be a uniformly increasing whole number.

    • It can’t contain text or decimal numbers.
    • Sometimes x-axis values appear to be dates, but they’re actually formatted as text. They won’t work for forecasting.

     

    If you still want the x-axis of the line chart to contain text, then you need to create measures for the forecast values. For example, in my example data, I used a simple linear regression equation to predict the value( [Simple linear regression] ), which means that the measure is equivalent to the FORECAST function in Excel. You can use other methods for prediction as needed.

     

    Measure = 
    VAR lastnotblankweek =
        CALCULATE (
            MAX ( Dates[WeekNum] ),
            FILTER ( ALLSELECTED ( 'Table' ), [SumValue] <> BLANK () )
        )
    RETURN
        IF (
            MAX ( Dates[WeekNum] ) = lastnotblankweek,
            [SumValue],
            IF ( [SumValue] = BLANK (), [Simple linear regression] )
        )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.