Forum Discussion

willstr's avatar
willstr
New Member
2 years ago
Solved

Qliksense Expression to Dax

Help - I am trying to convert this Qlik Expression to DAX:

 

linest_m(total aggr(Sum(hosp_cost),Month_supply),Month_supply)*

only(Month_supply)+linest_b(total aggr(Sum(hosp_cost),Month_supply),Month_supply)

 

 

  • willstr , Try like

     

    Slope =
    VAR SlopeCalc =
    LINEST(
    Y_VALUES('Table'[hosp_cost]),
    X_VALUES('Table'[Month_supply],)
    )
    RETURN
    SlopeCalc[LineSlope]

    Intercept =
    VAR InterceptCalc =
    LINEST(
    Y_VALUES('Table'[hosp_cost]),
    X_VALUES('Table'[Month_supply],)
    )
    RETURN
    InterceptCalc[LineIntercept]


    Predicted Hosp Cost =
    [Slope] * MAX('Table'[Month_supply]) + [Intercept]

1 Reply

  • willstr , Try like

     

    Slope =
    VAR SlopeCalc =
    LINEST(
    Y_VALUES('Table'[hosp_cost]),
    X_VALUES('Table'[Month_supply],)
    )
    RETURN
    SlopeCalc[LineSlope]

    Intercept =
    VAR InterceptCalc =
    LINEST(
    Y_VALUES('Table'[hosp_cost]),
    X_VALUES('Table'[Month_supply],)
    )
    RETURN
    InterceptCalc[LineIntercept]


    Predicted Hosp Cost =
    [Slope] * MAX('Table'[Month_supply]) + [Intercept]