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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Filter table with multiple logical conditions dynamically

Hi everyone! I want to create a new table in which I want the user to be able to change its filter dynamically, but the filter should works according to the following logic:

 

 

(columnA > [slicerValue] && columnB > [slicerValue]) || (columnA = [slicerValue] && columnC = [slicerValue])

 

 

As I´ve mentioned, I want to the user to be able to change the table using a slicer (or any other way of filtering dynamically).

 

I am a little new to Power Bi and haven´t found a way to do that yet, so if someone can include some images as examples would be great!

2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @Anonymous,

 

Can you please try this approach:

 

1. Create a table for the slicer

SlicerTable = DISTINCT(financial[ColumnA])

2. Create a measure that applies your filtering logic dynamically

DynamicFilter = 
VAR SelectedValue = SELECTEDVALUE(SlicerTable[ColumnA])
RETURN
IF(
    (MAX(financial[ColumnA]) > SelectedValue && MAX(financial[ColumnB]) > SelectedValue) ||
    (MAX(financial[ColumnA]) = SelectedValue && MAX(financial[ColumnC]) = SelectedValue),
    1,
    0
)

Hope this helps.

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

Anonymous
Not applicable

Hi @Anonymous ,

 

I want to acknowledge valuable input provided by Sahir_Maharaj  and rajendraongole1  . Their initial ideas help guide my approach. However, I noticed that more details are needed to fully understand this issue.

 

It is not possible to get the parameters of the slicer in the calculation table, this is due to the design, so I recommend that you create a table visual object for presenting the data.

(1) Create a slicer table.

SlicerValues = GENERATESERIES(1, 100, 1)

(2) Create a measure.

Flag = 
VAR SelectedValue = SELECTEDVALUE(SlicerValues[Value])
RETURN
IF(
    (MAX(financial[ColumnA]) > SelectedValue && MAX(financial[ColumnB]) > SelectedValue) ||
    (MAX(financial[ColumnA]) = SelectedValue && MAX(financial[ColumnC]) = SelectedValue),
    1,
    0
)

(3) Create a form visual object and set up filtering on the visual object.

vtangjiemsft_0-1736736993107.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

I want to acknowledge valuable input provided by Sahir_Maharaj  and rajendraongole1  . Their initial ideas help guide my approach. However, I noticed that more details are needed to fully understand this issue.

 

It is not possible to get the parameters of the slicer in the calculation table, this is due to the design, so I recommend that you create a table visual object for presenting the data.

(1) Create a slicer table.

SlicerValues = GENERATESERIES(1, 100, 1)

(2) Create a measure.

Flag = 
VAR SelectedValue = SELECTEDVALUE(SlicerValues[Value])
RETURN
IF(
    (MAX(financial[ColumnA]) > SelectedValue && MAX(financial[ColumnB]) > SelectedValue) ||
    (MAX(financial[ColumnA]) = SelectedValue && MAX(financial[ColumnC]) = SelectedValue),
    1,
    0
)

(3) Create a form visual object and set up filtering on the visual object.

vtangjiemsft_0-1736736993107.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Sahir_Maharaj
Super User
Super User

Hello @Anonymous,

 

Can you please try this approach:

 

1. Create a table for the slicer

SlicerTable = DISTINCT(financial[ColumnA])

2. Create a measure that applies your filtering logic dynamically

DynamicFilter = 
VAR SelectedValue = SELECTEDVALUE(SlicerTable[ColumnA])
RETURN
IF(
    (MAX(financial[ColumnA]) > SelectedValue && MAX(financial[ColumnB]) > SelectedValue) ||
    (MAX(financial[ColumnA]) = SelectedValue && MAX(financial[ColumnC]) = SelectedValue),
    1,
    0
)

Hope this helps.

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
rajendraongole1
Super User
Super User

Hi @Anonymous  - First you can create a disconnected table with below logic

 

SlicerValues = GENERATESERIES(1, 100, 1)

 

create another calculated table, using the following DAX  and call the slicervalue in selectedvalue function.

FilteredTable =
VAR SelectedValue = SELECTEDVALUE(SlicerValues[Value])
RETURN
FILTER(
financial,
(financial[ColumnA] > SelectedValue && financial[ColumnB] > SelectedValue) ||
(financial[ColumnA] = SelectedValue && financial[ColumnC] = SelectedValue)
)

 

 

replace table name as per your mode and columns. 

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

I already tried that way but unfortunately it doesn´t work. It seems that when creating a new table, it is not possible to use SELECTEDVALUE() because, if I set it to a number instead of using SELECTEDVALUE(), it works fine.
For example, it works:

 

FilteredTable =
VAR SelectedValue = 2000
RETURN
FILTER(
financial,
(financial[ColumnA] > SelectedValue && financial[ColumnB] > SelectedValue) ||
(financial[ColumnA] = SelectedValue && financial[ColumnC] = SelectedValue)
)

 

But if I write SELECTEDVALUE() to capture the slicer value, then the table is empty all the time.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.