Forum Discussion

PowerBIUserX's avatar
PowerBIUserX
Frequent Visitor
2 years ago
Solved

Trend analysis using linear regression gradient per category

Hi,   I'm building a report and need to calculate a trend over time per category, to identify top increases/decreases over time. The end goal is to have a trend value (gradient of linear regressio...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi PowerBIUserX 

    I add a month column in the table

    Then modifiy the Lines measure

    Lines =
    VAR a =
        LINESTX (
            FILTER ( ALLSELECTED ( 'Table' ), [Category] IN VALUES ( 'Table'[Category] ) ),
            [Value_measure],
            [Month]
        )
    RETURN
        MINX ( a, [Slope1] )
    

    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