Apply aggregation to secondary axis and sort it on basic of xaxis data

I have created a combo chart(column and line chart). I’m sorting column chart according to axis. I want to sort line chat(secondary axis ) to sort as same as column chart. but it looks like this.
Screenshot 2023-08-07 104951
merge_df = bar_dff
merge_df.columns = [dimension, “bar_expression”]
merge_df[“line_expression”] = line_dff[“expression”]
fig = make_subplots(specs=[[{“secondary_y”: True}]], shared_xaxes=“rows”)

fig.add_trace(
    go.Bar(
        x=merge_df[dimension],
        y=merge_df["bar_expression"]
    )
)

fig.add_trace(
    go.Scatter(
        mode="lines",
        x=merge_df[dimension],
        y=merge_df["line_expression"]
        )
    )
)

if bar_sortation== “asc”:
fig.update_xaxes(categoryorder=“total ascending”)
elif expression_sortation == “desc”:
fig.update_xaxes(categoryorder=“total descending”)

if xaxis_sortation == "asc":
    fig.update_xaxes(categoryorder="category ascending")
elif dimension_sortation == "desc":
    fig.update_xaxes(categoryorder="category descending")

Because I’m using subplot, i was tried shared_axis = True attribut but it didn’t worked