Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
kshah1609
Regular Visitor

need help with slicer

I am using bind parameters option to dynamically fetch the data by modifying the sql query in advanced editor. Till then it works. Now, the client wants to copy paste list of values in slicer, something like 50 vaues at once. For that i tried to use mass filter  visual but there is a limitation in this case as well, that is that if after mass filtering the values, (i have 2 slicers for same value, normal one with select all enabled and mass filters one). and the flow is that one would first filter values using mass filter, then click on select all in normal slicers, as there is no option to sync slicers through different pages, and then when click on select all, it should display the values typed in mass filter only, but instead it shows all values when clicked on select all.

how to resolve that?

in my sql query, i use the parameter to filter the data such that, if the slicer is selected, it would append the where clause else if select all is clicked, it would not. how to resolve such that it filters, the values that are visible in slicer while clicking on select all not, all the values in general) or sync the slicer accross the pages.

 

(for some reasons i can't see posted reply)

@Akash_Varuna 

These are the error that i get when i try to use custom visuals: 

kshah1609_0-1739355555600.pngkshah1609_1-1739355562351.png

also, my sql query: 

let
// Flags for 'SelectAll' values
flagcol1 = if List.Contains(col1, "__SelectAll__") then 1 else 0,
flagcol2 = if List.Contains(col2, "__SelectAll__") then 1 else 0,

// Process selected values for col1, col2, and MIN_InvoiceNumber
selectedcol1 = if Type.Is(Value.Type(col1), List.Type) then
if List.Contains(col1, "__SelectAll__") then "All"
else Text.Combine(List.Transform(col1, each "'" & Text.From(_) & "'"), ",")
else Text.From(col1),

selectedcol2 = if Type.Is(Value.Type(col2), List.Type) then
if List.Contains(col2, "__SelectAll__") then "All"
else Text.Combine(List.Transform(col2, each "'" & Text.From(_) & "'"), ",")
else Text.From(col2),

selectedcol3 = if col3 = "NULL" or List.Contains(col3, "__SelectAll__") then ""
else Text.Combine(List.Transform(col3, each "'" & Text.From(_) & "'"), ","),

// Check if any other filter is applied
hasOtherFilters = Text.Length(selectedcol3) > 0,

// Build the WHERE clause based on selection
whereClause =
if selectedcol1 = "All" and selectedcol2 = "All" then "WHERE 1 = 1"
else if selectedcol1 <> "All" and selectedcol2 <> "All" then "WHERE [Column1] IN (" & selectedcol1 & ") AND SUBSTRING([Column2], 1, 5) IN (" & selectedcol2 & ")"
else if selectedcol2 = "All" then "WHERE [Column1] IN (" & selectedcol1 & ")"
else if selectedcol1 = "All" then "WHERE SUBSTRING([Column2], 1, 5) IN (" & selectedcol2 & ")"
else "",

// Build the full SQL query
fullQuery = "SELECT * FROM your_table_name " & whereClause &
(if Text.Length(selectedcol3) > 0 then " AND [Column3] IN (" & selectedcol3 & ")" else ""),

// Execute the SQL query
Source = Sql.Database("your_server_name", "your_database_name", [Query=fullQuery])
in
Source which works fine while using normal power bi slicer (with select all enabled). now if i try to use both normal slicer and mass filter (as idk what else i can use), and try to paste value and click filter, it filters the same values in normal slicer drop down as well , along with select all option(as expected as it is on same page and is made from same column of table). now, if i click on the select all option, it shows me all data instead of showing only all the values that i enetred in mass filter. how to achive this? (I am using direct query and bind parameters to bring data)

 

2 REPLIES 2
speedramps
Super User
Super User

So you want you user to copy and paste a list 50 values and then use that list to filter you report?


Consider building a new 'config' table with a one to many relationship to your fact table.

 

Then use Share Point, Power Automate flow or Power App to update the 'config' table.

 

The user can then update the table to filter the reports

 

In my case, I am using a single table, and as a slicer value, i am using distinct value from that table. however, i will look if i can somehow  use Share Point, Power Automate flow or Power App to update

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors