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
PBI_DAX_Newbie
New Member

How to create a proper Multi-(IN) Clause DAX Query

Hello,

 

My Scenario

I am trying to implement Dynamic RLS in Power BI and I am trying to add filters into my DAX and failing miserably. I am clearly writing it incorrectly and I also receive an error which I will describe below. And I get the model may be bleh but its what I have to work with.

 

Image I have the following ugly Schema and I want to pull out all the Invoices that are for a specific User. I would think of it like this in SQL Terms

 

Select * from Invoices where City in (Select City from Cities where State in (Select State from States where Region in (Select Region from Regions where Region in (Select Region from UserfTORegionMapping where EmailAddress = USERPRINCIPLENAME())))

(of course it would simply using = than ins above but its just one way to look at it)

 

But I am having no idea how to do this in DAX. I tried playing around with FILTER and IN but going passed a single = or IN and I immediatley and lost.

PBI_DAX_Newbie_0-1700085883062.png

 

Thank you Kindly for looking at this and helping

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PBI_DAX_Newbie ,

You can apply a filter in the table 'Invoices' when create a role with the below formula:

'Invoices'[City]
    IN CALCULATETABLE (
        VALUES ( 'Cities'[City] ),
        FILTER (
            ALL ( 'Cities' ),
            'Cities'[State]
                IN CALCULATETABLE (
                    VALUES ( 'States'[State] ),
                    FILTER (
                        ALL ( 'States' ),
                        'States'[Region]
                            IN CALCULATETABLE (
                                VALUES ( 'Regions'[Region] ),
                                FILTER (
                                    ALL ( 'UserfTORegionMapping' ),
                                    'UserfTORegionMapping'[EmailAddress] = USERPRINCIPALNAME ()
                                )
                            )
                    )
                )
        )
    )

In addition, you can refer the following links to get it:

Dynamic Row-Level Security in Power BI with NOT IN or NOT EQUAL Rule - RADACAD

Multi-level access rights in Dynamic Row Level Security - Abylon

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @PBI_DAX_Newbie ,

You can apply a filter in the table 'Invoices' when create a role with the below formula:

'Invoices'[City]
    IN CALCULATETABLE (
        VALUES ( 'Cities'[City] ),
        FILTER (
            ALL ( 'Cities' ),
            'Cities'[State]
                IN CALCULATETABLE (
                    VALUES ( 'States'[State] ),
                    FILTER (
                        ALL ( 'States' ),
                        'States'[Region]
                            IN CALCULATETABLE (
                                VALUES ( 'Regions'[Region] ),
                                FILTER (
                                    ALL ( 'UserfTORegionMapping' ),
                                    'UserfTORegionMapping'[EmailAddress] = USERPRINCIPALNAME ()
                                )
                            )
                    )
                )
        )
    )

In addition, you can refer the following links to get it:

Dynamic Row-Level Security in Power BI with NOT IN or NOT EQUAL Rule - RADACAD

Multi-level access rights in Dynamic Row Level Security - Abylon

Best Regards

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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