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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Watty
Regular Visitor

Power bi embedded rls complex

Hi All

 

I have watched the following video and got this working great,

Summarising what I think is happening, Power BI is smart enough to know the schema and add on the extra where clause using the dax filter [column_name]=username ( where the username is passed in from the token )

 

Now our requirement for the retriction of data is more complex (sql below) is this possible ?

 

Help would really be appeciated for this.

 

https://channel9.msdn.com/Blogs/Seth-Juarez/Power-BI-Embedded-with-Josh-Caplan

 

;WITH RelationsCTE (ParentId, Id)
AS
(
SELECT
nodes_assigned_to_user.ParentId
,nodes_assigned_to_user.Id
FROM Client.Node AS nodes_assigned_to_user
WHERE
ISNULL(Root_Id, Id) = @ClientId
AND Id IN (
SELECT nur.Node_Id
FROM account.NodeUserRole nur
INNER JOIN account.UserRole ur ON nur.UserRole_Id = ur.Id
WHERE ur.[User_Id] = @UserId
)
UNION ALL
SELECT child_nodes.ParentId, child_nodes.Id
FROM Client.Node AS child_nodes
INNER JOIN RelationsCTE AS related_nodes
ON child_nodes.ParentId = related_nodes.Id
)

SELECT *
FROM client.Node
WHERE Node.Id IN (SELECT Id FROM RelationsCTE)

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee

@Watty

Are you in DirectQuery mode?

 

Based on my test, in DirectQuery, neither Stored Procedure nor CTE is supported, even when I tried to bypass the limitation via wrapping the recursive CTE in a table valued funtion, it still pops up a window saying not supported. So you can just leave the dataset as simple, then try to deal with hierarchy via DAX.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors