- Open a local DirectQuery Power BI data model and select Edit Queries from report view to open the Query Editor.
- Create queries against the users and security views developed in Getting ready.
let Source = AdWorksProd,UserSalesCountry = Source{[Schema = "BI", Item = "vDim_UserSalesCountrySecurity"]}[Data]in UserSalesCountry
- Duplicate an existing query via the right-click context menu and revise the Item value to the name of the SQL view.
- Create one additional query, which retrieves the unique values of the column to be secured (Countries):
let Source = AdWorksProd,Territory = Source{[Schema = "BI", Item = "vDim_SalesTerritory"]}[Data],Countries = Table.SelectColumns(Territory,{"Sales Territory Country"}),DistinctCountries ...