Forum Discussion
MedIDRI
1 year agoRegular Visitor
Issue with RLS and DAX Measures
Hello everyone, I am facing an issue with a DAX measure in Power BI that uses the ISFILTERED and ISINSCOPE functions. I have implemented row-level security (RLS) based on the email address of the lo...
- 1 year ago
MedIDRI - you could use HASONEFILTER ( 'Dim Acteur'[CdVendeur]
SWITCH ( TRUE (), HASONEFILTER ( 'Dim Acteur'[CdVendeur] ), CALCULATE ( SUM ( 'Fait Vente'[MesureTCV] ), 'Dim Acteur'[TypeActeur] IN { "VRC", "VP" }, NOT ( LEFT ( 'Dim Acteur'[Code Fonction], 3 ) IN { "RDV", "RAV", "DAV", "DC", "DDV", "DAE" } ) ), 1000001 )I do understand that this will not work if users have access to more than one CdVendeur though.Possibilities are this is because ISFILTERED expects a direct filter on the column rather than one from RLS, it's due to the order of the queries (ie. where RLS is applied), it's by design OR we've found a bug with ISFILTERED
( marcorusso - do you have any knowledge on why ISFILTERED returns false when filtered through RLS but HASONEFILTER returns true? )
MedIDRI - ISINSCOPE will not work in this context because with a card 'Dim Acteur'[CdVendeur] is not in the context of the visual.
I've put a few more things in your file to help explain this. See attached.
NimaiAhluwalia
1 year agoContinued Contributor
Hello MedIDRI
Function Behavior with RLS Use Case
| ISFILTERED | Operates within RLS | Check if a specific column has any filter applied (e.g., slicers, RLS). |
| ISINSCOPE | Operates within RLS | Check if a column is part of the grouping or hierarchy context. |
I reckon working with this filters in the past with RLS and it was working fine for me.