Forum Discussion

cheid_4838's avatar
cheid_4838
Helper IV
1 year ago
Solved

Using SQL declared variables into Power BI

I have multiple SQL reports that declare more than one variable.  The SQL query below has only one variable utilizing dates, but most have multiple variables being declared  I would like to integrate...
  • v-pnaroju-msft's avatar
    1 year ago

    Thankyou, MohamedFowzan1CPCARDOSOkushanNa for your responses.

    Hi cheid_4838,

    Based on my understanding, in Import mode parameters can only be applied during refresh and cannot be bound to slicers. Consequently, the Bind to Parameter option does not appear. In DirectQuery mode, dynamic M parameters are supported; however, the current SQL query contains unsupported constructs such as correlated subqueries and ORDER BY in subqueries. These constructs break query folding, preventing DirectQuery from executing the query in its present form.

    If you remain in Import mode, parameters will work only at refresh time and will not be dynamic. If you require slicer driven parameters, switch to DirectQuery and simplify the SQL by using a database view or stored procedure that accepts parameters. This will enable query folding and allow binding slicers to parameters.

    Additionally, please refer to the following links:
    Value.NativeQuery - PowerQuery M | Microsoft Learn
    Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

    We hope this information helps to resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.

    Thank you.