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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Th0mc
Frequent Visitor

Need to dynamically filter on two columns adding the filter (OR operator)

Hi all,

 

Seems that my DAX knowledge is not sufficient.

Here are the needs :

- I want to filter a table depending on a visual slicer

- The value selected in this slicer combines a list of values for two columns of my table

- I want to filter whatever the condition is fulfiled for column1 or column2

 

Here is more details on a simple example :

- List of 'Domain Group' combining values to filter on SubDomain Code and Entity 3

CiKagL9Is3.png

- A sample of projects info that I want to filter

Th0mc_0-1666091278121.png

 

I created a slicer on 'Domain Group'.

I created a DAX column with the following formulae :

 

Filter on Domain+Entity = IF(Projects[Entity 3] IN VALUES('Domain Groups'[Entity 3]) || Projects[SubDomain Code] IN VALUES('Domain Groups'[SubDomain Code]), TRUE(),FALSE())

 

I filter the page by 'Filter on Domain+Entity' = True

 

When I filter on 'Engineering & Design', I expect to have the following result

Th0mc_1-1666091584943.png

 

When I filter on 'Finance & SAP', I expect to have the following result 

Th0mc_2-1666091622390.png

But in real life, the filter doesn't work at all, I have always all the table.

I have done a pbix sample file but I'm not able to share it 😞

 

Thanks for your help.

 

Thomas

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Th0mc ,

 

Please try:

Filter on Domain+Entity = 
VAR _domain_group =
    SELECTEDVALUE ( 'Domain Groups'[Domain Group] )
VAR _subdomain_code =
    CALCULATETABLE (
        VALUES ( 'Domain Groups'[SubDomain Code] ),
        'Domain Groups'[Domain Group] = _domain_group
    )
VAR _entity3 =
    CALCULATETABLE (
        VALUES ( 'Domain Groups'[Entity 3] ),
        'Domain Groups'[Domain Group] = _domain_group
    )
VAR _filter =
    IF (
        MAX ( 'Projects'[SubDomain Code] )
            IN _subdomain_code
                || MAX ( 'Projects'[Entity 3] ) IN _entity3,
        1
    )
RETURN
    _filter

vcgaomsft_0-1666246230919.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Th0mc ,

 

- I want to filter a table depending on a visual slicer

Is this table a table of the model or a table visual? If it is a table in the model, it does not interact with the slicer, it only recalculates on refresh. 

 

If it's table vision, you can share the sample files, which is useful. Thanks in advance. You can choose to upload the file to cloud storage and post the sharing link here.

How to provide sample data in the Power BI Forum

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Hi @Anonymous 

 

Yes, it is about filtering Table or Matrix visual.

The tricky part is that I need to filter with conditions on 2 columns 'SubDomain Code' and 'Entity 3' but 'adding' the conditions (OR) depending on another table.

I tried through a calculated column (DAX) because I though that it was dynamicaly calculated depending on filters in visuals but it is just the same as a column calculate in M, recalculated on refresh only. At least I learnt something ;).

But I'm still unable to make that filter works :(.

I tried to share through OneDrive but my company doesn't authorize sharing outside.

Here you should be able to have the tiny pbix I did to illustrate : https://filetransfer.io/data-package/xC4Yzb5j#link

 

Thx in advance

Thomas

Anonymous
Not applicable

Hi @Th0mc ,

 

Please try:

Filter on Domain+Entity = 
VAR _domain_group =
    SELECTEDVALUE ( 'Domain Groups'[Domain Group] )
VAR _subdomain_code =
    CALCULATETABLE (
        VALUES ( 'Domain Groups'[SubDomain Code] ),
        'Domain Groups'[Domain Group] = _domain_group
    )
VAR _entity3 =
    CALCULATETABLE (
        VALUES ( 'Domain Groups'[Entity 3] ),
        'Domain Groups'[Domain Group] = _domain_group
    )
VAR _filter =
    IF (
        MAX ( 'Projects'[SubDomain Code] )
            IN _subdomain_code
                || MAX ( 'Projects'[Entity 3] ) IN _entity3,
        1
    )
RETURN
    _filter

vcgaomsft_0-1666246230919.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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