Forum Discussion

powerbi_ex's avatar
powerbi_ex
Frequent Visitor
1 year ago
Solved

Slice by a Custom Column with Parameter

I created a parameter to use it in the where clause in the SQL (direct query) and bind to a column in a static table with same name called DateParam.   How to use the Past Time column in a slicer that slicers the value of its DateParm? 

 

Table

 

Bind Parameter

 

Power Query SQL

 

Slicer doesn't work when placing in report the way I am currenting doing it.

 

 

 

  • Hi powerbi_ex  - You're on the right track with using a parameter bound to a slicer, but the issue here is that you are trying to slice using a human-readable column (Past Time) while the actual parameter value being passed to the SQL query is DateParam (which is a number like -300, -1800, etc.).In Power BI, slicers do not directly update parameters unless the slicer is placed on the parameter-bound column itself, not on a display or helper column.

    In the slicer visual, drag the DateParam column (not Past Time) into the slicer.

    Set the visual to “Dropdown” or “List”.

    Change the display to show Past Time text, not the actual DateParam value:

    Select the slicer.

    Go to the Model view.

    Ensure DateParam is sorted by Order (you already have that).

    Create a calculated column or a disconnected table to show the labels — but ideally just change the slicer's column to Past Time, and bind the parameter manually.

    However, Power BI currently doesn’t support indirect binding (i.e., clicking on Past Time to change the value of DateParam) in the slicer natively unless you’re using field parameters or what-if parameters.

     

    Modelling tab>> field parametes check this..

     

    Hope this helps.

2 Replies

  • Hi powerbi_ex  - You're on the right track with using a parameter bound to a slicer, but the issue here is that you are trying to slice using a human-readable column (Past Time) while the actual parameter value being passed to the SQL query is DateParam (which is a number like -300, -1800, etc.).In Power BI, slicers do not directly update parameters unless the slicer is placed on the parameter-bound column itself, not on a display or helper column.

    In the slicer visual, drag the DateParam column (not Past Time) into the slicer.

    Set the visual to “Dropdown” or “List”.

    Change the display to show Past Time text, not the actual DateParam value:

    Select the slicer.

    Go to the Model view.

    Ensure DateParam is sorted by Order (you already have that).

    Create a calculated column or a disconnected table to show the labels — but ideally just change the slicer's column to Past Time, and bind the parameter manually.

    However, Power BI currently doesn’t support indirect binding (i.e., clicking on Past Time to change the value of DateParam) in the slicer natively unless you’re using field parameters or what-if parameters.

     

    Modelling tab>> field parametes check this..

     

    Hope this helps.

  • Hi powerbi_ex 

    Fields or numeric parameters created within the model cannot be used to filter a query. Power Query has its own parameters, which exist solely within the query editor. Changes made in the query editor influence the semantic model, but the semantic model does not directly affect the query editor